Skip to content

Commit e4f385a

Browse files
added unique return code for when run is not reportable
1 parent 1dc5112 commit e4f385a

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ def pytest_configure(config):
329329
raise OSError("Could not find TestRail credentials")
330330

331331
if not tri.reportable():
332-
pytest.exit("Test run is not reportable. Exiting.")
332+
# exit code of 2 for when test run is not reportable.
333+
pytest.exit("Test run is not reportable. Exiting.", 2)
333334

334335

335336
def pytest_sessionfinish(session):

l10n_CM/run_l10n.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ def run_tests(reg, site, flg, all_tests):
8989
else:
9090
logging.info(f"{reg} region on {site} site has no tests.")
9191
except subprocess.CalledProcessError as e:
92-
logging.warning(f"Test run failed. {e}")
93-
if os.environ.get("TEST_EXIT_CODE") == "0":
94-
with open("TEST_EXIT_CODE", "w") as f:
95-
f.write(f"TEST_EXIT_CODE={str(e.returncode)}\n")
96-
os.environ["TEST_EXIT_CODE"] = str(e.returncode)
92+
logging.warning(f"Test run failed with exit code: {e.returncode}")
93+
# true failure instead of run not being reportable.
94+
if e.returncode != 2:
95+
if os.environ.get("TEST_EXIT_CODE") == "0":
96+
with open("TEST_EXIT_CODE", "w") as f:
97+
f.write(f"TEST_EXIT_CODE={str(e.returncode)}\n")
98+
os.environ["TEST_EXIT_CODE"] = str(e.returncode)
9799

98100

99101
def get_region_tests(test_region: str) -> list[str]:

0 commit comments

Comments
 (0)