mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Add a test loader script for Zenmap, so tests don't fail with Python <2.7
This commit is contained in:
@@ -401,7 +401,7 @@ nsock_check:
|
||||
@cd $(NSOCKDIR)/src && $(MAKE) check
|
||||
|
||||
zenmap_check:
|
||||
@cd $(ZENMAPDIR) && $(PYTHON) -m unittest discover build/lib.* '*.py'
|
||||
@cd $(ZENMAPDIR)/test && $(PYTHON) run_tests.py
|
||||
|
||||
check: @NCAT_CHECK@ @NSOCK_CHECK@ @ZENMAP_CHECK@ @NSE_CHECK@ @NDIFF_CHECK@
|
||||
|
||||
|
||||
18
zenmap/test/run_tests.py
Normal file
18
zenmap/test/run_tests.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import unittest
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
import glob
|
||||
import os
|
||||
if not hasattr(unittest.defaultTestLoader, "discover"):
|
||||
print("Python unittest discovery missing. Requires Python 2.7 or newer.")
|
||||
sys.exit(0)
|
||||
|
||||
os.chdir("..")
|
||||
suite = unittest.defaultTestLoader.discover(
|
||||
start_dir=glob.glob("build/lib.*")[0],
|
||||
pattern="*.py"
|
||||
)
|
||||
unittest.TextTestRunner().run(suite)
|
||||
Reference in New Issue
Block a user