Skip to content

Commit 4fe5379

Browse files
committed
Avoid some errors when envvars are not set
Signed-off-by: Stefan Marr <[email protected]>
1 parent ac00ae5 commit 4fe5379

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

IntegrationTests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def pytest_runtest_logreport(report):
3838
# Run after all tests completed, Generate a report of failing and passing tests
3939
def pytest_sessionfinish(session, exitstatus):
4040
print("Running this method")
41-
os.makedirs(GENERATE_REPORT_LOCATION, exist_ok=True)
4241
if GENERATE_REPORT:
42+
os.makedirs(GENERATE_REPORT_LOCATION, exist_ok=True)
4343
report_message = f"""
4444
Pytest Completed with {tests_passed}/{total_tests} passing:
4545

IntegrationTests/test_runner.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,13 @@ def checkOut(result, expstd, experr, errorMessage):
195195
)
196196

197197
debug(f"Opening test_tags")
198-
with open(f"{vars.TEST_EXCEPTIONS}", "r") as f:
199-
yamlFile = yaml.safe_load(f)
200-
vars.known_failures = (yamlFile["known_failures"])
201-
vars.failing_as_unspecified = (yamlFile["failing_as_unspecified"])
202-
vars.unsupported = (yamlFile["unsupported"])
203-
vars.do_not_run = yamlFile["do_not_run"] # Tests here do not fail at a SOM level but at a python level (e.g. Invalud UTF-8 characters)
198+
if vars.TEST_EXCEPTIONS:
199+
with open(f"{vars.TEST_EXCEPTIONS}", "r") as f:
200+
yamlFile = yaml.safe_load(f)
201+
vars.known_failures = (yamlFile["known_failures"])
202+
vars.failing_as_unspecified = (yamlFile["failing_as_unspecified"])
203+
vars.unsupported = (yamlFile["unsupported"])
204+
vars.do_not_run = yamlFile["do_not_run"] # Tests here do not fail at a SOM level but at a python level (e.g. Invalud UTF-8 characters)
204205

205206
debugList(vars.known_failures, prefix="Failure expected from: ")
206207
debugList(vars.failing_as_unspecified, prefix="Failure expected through undefined behaviour: ")
@@ -272,10 +273,8 @@ def tests_runner(name, stdout, stderr, customCP):
272273
assert(False), f"Test {name} is in unsupported but passed"
273274
elif (str(name) in vars.unsupported and testPassed is False): # Test failed as expected
274275
assert(True)
275-
276+
276277
if (str(name) not in vars.unsupported and str(name) not in vars.known_failures and str(name) not in vars.failing_as_unspecified):
277278
if (not testPassed):
278279
vars.failedUnexpectedly.append(name)
279280
assert(testPassed), f"Error on test, {name} expected to pass: {errMsg}"
280-
281-

0 commit comments

Comments
 (0)