Nmap Development mailing list archives
Re: [nmap-svn] r33597 - in nmap: . zenmap/test
From: Jacek Wielemborek <d33tah () gmail com>
Date: Sat, 23 Aug 2014 10:56:31 +0200
23.08.2014 06:22, commit-mailer () nmap org:
Author: dmiller
Date: Sat Aug 23 04:22:09 2014
New Revision: 33597
Log:
Add a test loader script for Zenmap, so tests don't fail with Python <2.7
Added:
nmap/zenmap/test/run_tests.py
Modified:
nmap/Makefile.in
Modified: nmap/Makefile.in
==============================================================================
--- nmap/Makefile.in (original)
+++ nmap/Makefile.in Sat Aug 23 04:22:09 2014
@@ -401,7 +401,7 @@
@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@
Added: nmap/zenmap/test/run_tests.py
==============================================================================
--- (empty file)
+++ nmap/zenmap/test/run_tests.py Sat Aug 23 04:22:09 2014
@@ -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)
_______________________________________________
Sent through the svn mailing list
http://nmap.org/mailman/listinfo/svn
Daniel, The bugfixes you recently pushed are nice. I am not sure though whether exiting with an exit code of zero is a good idea if unittest is missing. One usually runs the testing script to see if the tests work and in this case "make test" could give a false positive in a possibly too-long-to-read log. It would probably be better to sys.exit(1) and - if necessary - silence the error in the Makefile. By the way, perhaps it would make sense to backport unittest to solve this problem? Jacek
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: [nmap-svn] r33597 - in nmap: . zenmap/test Jacek Wielemborek (Aug 23)
- Re: [nmap-svn] r33597 - in nmap: . zenmap/test Daniel Miller (Aug 23)
