Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
558acbaa
Commit
558acbaa
authored
Aug 15, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test_runner.py
parent
a7972639
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
trans/test_runner.py
trans/test_runner.py
+12
-8
No files found.
trans/test_runner.py
View file @
558acbaa
# coding: utf-8
# coding: utf-8
import
argparse
import
argparse
import
logging
#logging.basicConfig(level=logging.DEBUG)
from
os
import
system
,
environ
from
os
import
system
,
environ
from
pathlib
import
Path
from
pathlib
import
Path
...
@@ -17,12 +19,15 @@ load_dotenv()
...
@@ -17,12 +19,15 @@ load_dotenv()
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-c"
,
"--compile"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-c"
,
"--compile"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-g"
,
"--generate"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-o"
,
"--only"
,
nargs
=
"+"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
def
run_tests
():
def
run_tests
():
for
path
in
Path
(
'tests'
).
glob
(
'*.py'
):
for
path
in
Path
(
'tests'
).
glob
(
'*.py'
):
if
args
.
only
and
path
.
stem
not
in
args
.
only
:
continue
print
(
path
.
name
)
print
(
path
.
name
)
if
path
.
name
.
startswith
(
'_'
):
if
path
.
name
.
startswith
(
'_'
):
print
(
"Skipping"
)
print
(
"Skipping"
)
...
@@ -30,6 +35,7 @@ def run_tests():
...
@@ -30,6 +35,7 @@ def run_tests():
with
open
(
path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
code
=
f
.
read
()
code
=
f
.
read
()
execute
=
"# norun"
not
in
code
execute
=
"# norun"
not
in
code
compile
=
"# nocompile"
not
in
code
res
=
format_code
(
transpile
(
code
,
path
.
name
,
path
))
res
=
format_code
(
transpile
(
code
,
path
.
name
,
path
))
#print(res)
#print(res)
name_cpp
=
path
.
with_suffix
(
'.cpp'
)
name_cpp
=
path
.
with_suffix
(
'.cpp'
)
...
@@ -38,15 +44,13 @@ def run_tests():
...
@@ -38,15 +44,13 @@ def run_tests():
print
(
".cpp generated"
)
print
(
".cpp generated"
)
if
args
.
compile
:
if
args
.
compile
:
continue
continue
if
not
execute
:
execute_str
=
"true"
if
(
execute
and
not
args
.
generate
)
else
"false"
print
(
"Not executing"
,
path
.
name
)
continue
name_bin
=
path
.
with_suffix
(
''
).
as_posix
()
name_bin
=
path
.
with_suffix
(
''
).
as_posix
()
commands
=
[
commands
=
[
f'bash -c "
PYTHONPATH=stdlib python3 ./
{
path
.
as_posix
()
}
"'
,
f'bash -c "
export PYTHONPATH=stdlib; if
{
execute_str
}
; then python3 ./
{
path
.
as_posix
()
}
; fi
"'
,
]
]
if
alt
:
=
environ
.
get
(
"ALT_RUNNER"
):
if
compile
and
(
alt
:
=
environ
.
get
(
"ALT_RUNNER"
)
):
commands
.
append
(
alt
.
format
(
name_bin
=
name_bin
,
name_cpp_posix
=
name_cpp
.
as_posix
()))
commands
.
append
(
alt
.
format
(
name_bin
=
name_bin
,
name_cpp_posix
=
name_cpp
.
as_posix
()
,
run_file
=
execute_str
))
else
:
else
:
print
(
"no ALT_RUNNER"
)
print
(
"no ALT_RUNNER"
)
for
cmd
in
commands
:
for
cmd
in
commands
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment