mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 21:51:28 +00:00
Add a test loader script for Zenmap, so tests don't fail with Python <2.7
This commit is contained in:
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