[Checkins] SVN: zope.testrunner/trunk/ Use a temporary coverage directory in the test suite.

Marius Gedminas cvs-admin at zope.org
Fri Feb 8 10:04:44 UTC 2013


Log message for revision 129214:
  Use a temporary coverage directory in the test suite.
  
  So that tests executed by detox in parallel don't conflict.
  
  

Changed:
  U   zope.testrunner/trunk/CHANGES.txt
  U   zope.testrunner/trunk/src/zope/testrunner/testrunner-coverage.txt

-=-
Modified: zope.testrunner/trunk/CHANGES.txt
===================================================================
--- zope.testrunner/trunk/CHANGES.txt	2013-02-08 10:00:00 UTC (rev 129213)
+++ zope.testrunner/trunk/CHANGES.txt	2013-02-08 10:04:44 UTC (rev 129214)
@@ -18,7 +18,10 @@
 - New option: --profile-directory.  Use it in the test suite so that tests
   executed by detox in parallel don't conflict.
 
+- Use a temporary coverage directory in the test suite so that tests
+  executed by detox in parallel don't conflict.
 
+
 4.1.0 (2013-02-07)
 ==================
 

Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-coverage.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-coverage.txt	2013-02-08 10:00:00 UTC (rev 129213)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-coverage.txt	2013-02-08 10:04:44 UTC (rev 129214)
@@ -5,15 +5,18 @@
 directory name given as the parameter will be used to hold the reports.
 
 
-    >>> import os.path, sys
+    >>> import os.path, sys, tempfile
     >>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex')
     >>> defaults = [
     ...     '--path', directory_with_tests,
     ...     '--tests-pattern', '^sampletestsf?$',
     ...     ]
 
-    >>> sys.argv = 'test --coverage=coverage_dir'.split()
+    >>> tempdir = tempfile.mkdtemp(prefix='zope.testrunner-')
+    >>> coverage_dir = os.path.join(tempdir, 'coverage_dir')
 
+    >>> sys.argv = ['test', '--coverage', coverage_dir]
+
     >>> from zope import testrunner
     >>> testrunner.run_internal(defaults)
     Running samplelayers.Layer1 tests:
@@ -68,15 +71,15 @@
 The directory specified with the --coverage option will have been created and
 will hold the coverage reports.
 
-    >>> os.path.exists('coverage_dir')
+    >>> os.path.exists(coverage_dir)
     True
-    >>> os.listdir('coverage_dir')
+    >>> os.listdir(coverage_dir)
     [...]
 
 (We should clean up after ourselves.)
 
     >>> import shutil
-    >>> shutil.rmtree('coverage_dir')
+    >>> shutil.rmtree(tempdir)
 
 
 Ignoring Tests



More information about the checkins mailing list