Skip to content

Commit c8124e6

Browse files
author
Nils Bars
committed
Add support to exclude sub tasks when invoking task check
1 parent 8f4374a commit c8124e6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ref_utils/decorator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from dataclasses import dataclass, asdict
1010
import warnings
1111
import json
12+
import os
1213

1314
TEST_RESULT_PATH = Path("/var/test_result")
1415
DEFAULT_TASK_NAME = 'default'
@@ -119,6 +120,11 @@ def run_tests() -> None:
119120
has_multiple_tasks = len(__registered_tasks) > 1
120121
task_test_results: ty.List[_TestResult] = []
121122

123+
# This is set by task.py if the user only wants to run a subset of tests.
124+
only_run_these_tasks = os.environ.get("ONLY_RUN_THESE_TASKS")
125+
if only_run_these_tasks:
126+
only_run_these_tasks = only_run_these_tasks.split(":")
127+
122128
# Run all sub-tasks one after another.
123129
for task_name, tests in __registered_tasks.items():
124130
task_passed = True
@@ -127,6 +133,9 @@ def run_tests() -> None:
127133

128134
if has_multiple_tasks:
129135
print_ok(f'[+] *** Running tests for task \"{task_name}\" ***')
136+
if only_run_these_tasks and task_name not in only_run_these_tasks:
137+
print_ok(f"[+] User requested to exclude task, skipping...")
138+
continue
130139

131140
if tests.env_tests and not tests.submission_test and not tests.extended_submission_test:
132141
raise RefUtilsError("Using @environment_test without @submission_test or @extended_submission_test is not allowed")

0 commit comments

Comments
 (0)