mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Handle missing test_results due to pytest runner interrupt
If pytest execution is interrupted, the hook that exposes test_results to the pytest session is never called so the results can't be interpreted.
This commit is contained in:
parent
1cc55d01c7
commit
0a063f51d3
@ -316,10 +316,17 @@ if os.getenv("LEGACY_TEST_RUNNER", "0") == "0":
|
||||
def get_test_result():
|
||||
"""Aggregate test results from all individual tests from this module
|
||||
into a single result: failed > skipped > passed."""
|
||||
try:
|
||||
all_test_results = request.session.test_results
|
||||
except AttributeError:
|
||||
# This may happen if pytest execution is interrupted and
|
||||
# pytest_runtest_makereport() is never called.
|
||||
logger.debug("can't obtain test results, test run was interrupted")
|
||||
return "error"
|
||||
test_results = {
|
||||
node.nodeid: request.session.test_results[node.nodeid]
|
||||
node.nodeid: all_test_results[node.nodeid]
|
||||
for node in request.node.collect()
|
||||
if node.nodeid in request.session.test_results
|
||||
if node.nodeid in all_test_results
|
||||
}
|
||||
logger.debug(test_results)
|
||||
assert len(test_results)
|
||||
|
Loading…
x
Reference in New Issue
Block a user