1
0
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:
dmiller
2014-08-23 04:22:09 +00:00
parent 552b0bf226
commit b75df9d8f9
2 changed files with 19 additions and 1 deletions

View File

@@ -401,7 +401,7 @@ nsock_check:
@cd $(NSOCKDIR)/src && $(MAKE) check @cd $(NSOCKDIR)/src && $(MAKE) check
zenmap_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@ check: @NCAT_CHECK@ @NSOCK_CHECK@ @ZENMAP_CHECK@ @NSE_CHECK@ @NDIFF_CHECK@

18
zenmap/test/run_tests.py Normal file
View 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)