Propagate test results to exit status in check-zenmap

zenmap/test/run_tests.py discarded the TestResult, so the script always
exited 0 and 'make check-zenmap' reported success even when tests failed
or modules failed to import. Exit nonzero when the suite is unsuccessful,
and also exit 1 (not 0) when unittest discovery itself is unavailable.
Fixes #3469.
This commit is contained in:
Mrx 2026-09-21 02:26:24 +05:30
parent e135983b21
commit 91328a5eb4

View file

@ -7,11 +7,12 @@ if __name__ == "__main__":
import os
if not hasattr(unittest.defaultTestLoader, "discover"):
print("Python unittest discovery missing. Requires Python 3.0 or newer.") # noqa
sys.exit(0)
sys.exit(1)
os.chdir("..")
suite = unittest.defaultTestLoader.discover(
start_dir=".",
pattern="*.py"
)
unittest.TextTestRunner().run(suite)
result = unittest.TextTestRunner().run(suite)
sys.exit(not result.wasSuccessful())