[GRASS-SVN] r61439 - grass/trunk/lib/python/gunittest

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 28 18:45:20 PDT 2014


Author: wenzeslaus
Date: 2014-07-28 18:45:20 -0700 (Mon, 28 Jul 2014)
New Revision: 61439

Modified:
   grass/trunk/lib/python/gunittest/invoker.py
   grass/trunk/lib/python/gunittest/reporters.py
Log:
gunittest: different name for toplevel testsuite index (because of conflict with main index), close file, and finish main test files index sooner

Modified: grass/trunk/lib/python/gunittest/invoker.py
===================================================================
--- grass/trunk/lib/python/gunittest/invoker.py	2014-07-29 01:01:45 UTC (rev 61438)
+++ grass/trunk/lib/python/gunittest/invoker.py	2014-07-29 01:45:20 UTC (rev 61439)
@@ -196,9 +196,10 @@
         for module in modules:
             self._run_test_module(module=module, results_dir=results_dir,
                                   gisdbase=gisdbase, location=location)
+        self.reporter.finish()
 
         testsuite_dir_reporter = TestsuiteDirReporter(
-            main_page_name='testsuites.html')
+            main_page_name='testsuites.html', testsuite_page_name='index.html',
+            top_level_testsuite_page_name='testsuite_index.html')
         testsuite_dir_reporter.report_for_dirs(root=results_dir,
                                                directories=self.testsuite_dirs)
-        self.reporter.finish()

Modified: grass/trunk/lib/python/gunittest/reporters.py
===================================================================
--- grass/trunk/lib/python/gunittest/reporters.py	2014-07-29 01:01:45 UTC (rev 61438)
+++ grass/trunk/lib/python/gunittest/reporters.py	2014-07-29 01:45:20 UTC (rev 61439)
@@ -919,9 +919,11 @@
 # TODO: add also keyvalue summary generation?
 # wouldn't this conflict with collecting data from report afterwards?
 class TestsuiteDirReporter(object):
-    def __init__(self, main_page_name, testsuite_page_name='index.html'):
+    def __init__(self, main_page_name, testsuite_page_name='index.html',
+                 top_level_testsuite_page_name=None):
         self.main_page_name = main_page_name
         self.testsuite_page_name = testsuite_page_name
+        self.top_level_testsuite_page_name = top_level_testsuite_page_name
 
         # TODO: this might be even a object which could add and validate
         self.failures = 0
@@ -954,6 +956,10 @@
         file_successes = 0
 
         page_name = os.path.join(root, directory, self.testsuite_page_name)
+        if (self.top_level_testsuite_page_name and
+                os.path.abspath(os.path.join(root, directory))
+                == os.path.abspath(root)):
+            page_name = os.path.join(root, self.top_level_testsuite_page_name)
         page = open(page_name, 'w')
         head = (
             '<html><body>'
@@ -1056,6 +1062,7 @@
             directory=directory, tests_authors=test_files_authors)
         page.write(test_authors)
         page.write('</body></html>')
+        page.close()
 
         status = success_to_html_text(total=file_total, successes=file_successes)
         row = (



More information about the grass-commit mailing list