Skip to content

Commit 2bb0133

Browse files
committed
Add ability for tests to mark that they should be skipped
1 parent 98cae81 commit 2bb0133

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

runner/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def setup_argparse():
211211
except Exception as e:
212212
print(f"Test '{path}' failed with error: {e}")
213213
else:
214-
for file in result.files:
214+
for file in (result.files if result is not None else []):
215215
if submit_images:
216216
submit_image(result, hardware, timestamp, file, runner_id, submit_url)
217217
else:
@@ -233,6 +233,8 @@ def setup_argparse():
233233
except Exception as e:
234234
print(f"Test '{file}' failed with error: {e}")
235235
continue
236+
if result is None:
237+
continue
236238
for img in result.files:
237239
if submit_images:
238240
submit_image(result, hardware, timestamp, img, runner_id, submit_url)
@@ -258,6 +260,8 @@ def setup_argparse():
258260
except Exception as e:
259261
print(f"Test '{path}' failed with error: {e}")
260262
continue
263+
if result is None:
264+
continue
261265
for file in result.files:
262266
if submit_images:
263267
submit_image(result, hardware, timestamp, file, runner_id, submit_url)

runner/testsuite/openspace.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ def run_single_test(test_path, executable) -> TestResult:
132132
print(f"Running test: {test_path}")
133133
test = Test(test_path)
134134

135+
# Skip the test if the test-creator asked for it
136+
if test.skipTest:
137+
print(f" Skipping test {test_path}")
138+
return None
139+
135140
start_time = time.perf_counter()
136141
print(f" Starting OpenSpace (Profile: {test.profile})")
137142
process = subprocess.Popen(

runner/testsuite/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def __init__(self, path: str):
6868
if content["commands"] is None:
6969
raise Exception(f"Missing 'commands' in test {path}")
7070

71+
self.skipTest = content.get("skip_test", False)
72+
7173
self.instructions = []
7274
for command in content["commands"]:
7375
try:

0 commit comments

Comments
 (0)