mirror of
https://github.com/nmap/nmap.git
synced 2026-11-28 10:30:14 +00:00
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:
parent
e135983b21
commit
91328a5eb4
1 changed files with 3 additions and 2 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue