diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-07-03 15:05:08 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@chickadee.tech> | 2017-08-11 17:16:13 -0700 |
| commit | fab634e3eeb456e9d5dffa2cabb9ded39c45d6b6 (patch) | |
| tree | 4f1926142546130d7bd0388303ebe0cd2ab1181c /tools/tinytest-codegen.py | |
| parent | f6a702538a0b3dd72879d65e3acc32520d4371f5 (diff) | |
Turn on Rosie CI testing to test new builds on real hardware.
This introduces a skip_if module that can be used by tests to
determine when they should be skipped due to the environment.
Some tests have been split in order to have finer grained skip
control.
Diffstat (limited to 'tools/tinytest-codegen.py')
| -rwxr-xr-x | tools/tinytest-codegen.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py index dadfea1cc..0f9e62847 100755 --- a/tools/tinytest-codegen.py +++ b/tools/tinytest-codegen.py @@ -20,7 +20,23 @@ def chew_filename(t): def script_to_map(t): r = { 'name': chew_filename(t)['func'] } - with open(t) as f: r['script'] = escape(''.join(f.readlines())) + with open(t) as test: + script = test.readlines() + + # Test for import skip_if and inject it into the test as needed. + if "import skip_if\n" in script: + index = script.index("import skip_if\n") + script.pop(index) + script.insert(index, "class skip_if:\n") + with open("../tests/skip_if.py") as skip_if: + total_lines = 1 + for line in skip_if: + stripped = line.strip() + if not stripped or stripped.startswith(("#", "\"\"\"")): + continue + script.insert(index + total_lines, "\t" + line) + total_lines += 1 + r['script'] = escape(''.join(script)) return r test_function = ( |
