[Checkins] SVN: z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/ checkpoint
Jim Fulton
jim at zope.com
Sun Aug 16 09:46:27 EDT 2009
Log message for revision 102854:
checkpoint
Changed:
U z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.py
U z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.txt
U z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/testing.py
D z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/tests/
A z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/tests.py
-=-
Modified: z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.py
===================================================================
--- z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.py 2009-08-16 12:46:03 UTC (rev 102853)
+++ z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.py 2009-08-16 13:46:27 UTC (rev 102854)
@@ -27,9 +27,10 @@
def start(self):
self.start = time.time()
self.process = subprocess.Popen(
- [self.script, '--exit-with-status'] + self.args,
+ [sys.executable, self.script, '--exit-with-status'] + self.args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
close_fds=True)
def poll(self):
@@ -65,7 +66,9 @@
default_time = sum(stats.values()) / float(len(stats))
else:
default_time = 0
- scripts.sort(key=lambda package:-stats.get(os.path.basename(package), default_time))
+ scripts.sort(
+ key=lambda package:-stats.get(os.path.basename(package), default_time)
+ )
# Main loop for controlling test runs
while scripts or running:
Modified: z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.txt
===================================================================
--- z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.txt 2009-08-16 12:46:03 UTC (rev 102853)
+++ z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/runner.txt 2009-08-16 13:46:27 UTC (rev 102854)
@@ -9,37 +9,42 @@
It monitors the stdout of those processes and reports back packages with
failures.
->>> import os
->>> ok_script = os.path.join(sample_buildout, 'test-ok')
->>> write(ok_script, '#!/bin/bash\n sleep 1; exit')
->>> os.chmod(ok_script, 0755)
+ >>> import os, sys
->>> failure_script = os.path.join(sample_buildout, 'test-failure')
->>> write(failure_script, '#!/bin/bash\n sleep 1; echo ouch; exit 1')
->>> os.chmod(failure_script, 0755)
+ >>> ok_script = os.path.join(sample_buildout, 'test-ok')
+ >>> failure_script = os.path.join(sample_buildout, 'test-failure')
+ >>> if sys.platform.startswith('win'):
+ ... ok_script += '-script.py'
+ ... failure_script += '-script.py'
->>> import os.path
->>> from z3c.recipe.compattest.runner import main
->>> main(1, ok_script, failure_script)
-Running test-ok
-Running test-failure
-test-failure failed with:
-ouch
-<BLANKLINE>
-1 failure(s).
-- test-failure
+ >>> write(ok_script, """
+ ... import time
+ ... time.sleep(1)
+ ... print 'ok'
+ ... """)
+ >>> write(failure_script, """
+ ... import time
+ ... time.sleep(1)
+ ... raise SystemError('Fail!')
+ ... """)
->>> main(2, failure_script, ok_script, failure_script, ok_script)
-Running test-failure
-Running test-ok
-test-failure failed with:
-ouch
-<BLANKLINE>
-Running test-failure
-Running test-ok
-test-failure failed with:
-ouch
-<BLANKLINE>
-2 failure(s).
-- test-failure
-- test-failure
+ >>> from z3c.recipe.compattest.runner import main
+ >>> main(1, ok_script, failure_script)
+ Running test-ok
+ Running test-failure
+ test-failure failed with:
+ Traceback (most recent call last):
+ ...
+ SystemError: Fail!
+ <BLANKLINE>
+ 1 failure(s).
+ - test-failure
+
+Note that when we pass a number greater than 1 as the first argument,
+tests are run in parallel, so the order of output varies.
+
+ >>> main(2, failure_script, ok_script, failure_script, ok_script)
+ Running ...
+ 2 failure(s).
+ - test-failure
+ - test-failure
Modified: z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/testing.py
===================================================================
--- z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/testing.py 2009-08-16 12:46:03 UTC (rev 102853)
+++ z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/testing.py 2009-08-16 13:46:27 UTC (rev 102854)
@@ -1,5 +1,4 @@
import doctest
-import unittest
import zc.buildout.testing
@@ -26,7 +25,6 @@
kw['setUp'] = setUp
kw['tearDown'] = tearDown
kw['optionflags'] = (doctest.ELLIPSIS
- | doctest.REPORT_NDIFF
| doctest.NORMALIZE_WHITESPACE)
return doctest.DocFileSuite(*args, **kw)
Copied: z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/tests.py (from rev 102853, z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/tests/test_doctests.py)
===================================================================
--- z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/tests.py (rev 0)
+++ z3c.recipe.compattest/branches/jim-windows-whimper/src/z3c/recipe/compattest/tests.py 2009-08-16 13:46:27 UTC (rev 102854)
@@ -0,0 +1,6 @@
+import z3c.recipe.compattest.testing
+
+
+def test_suite():
+ return z3c.recipe.compattest.testing.DocFileSuite(
+ 'README.txt', 'runner.txt')
More information about the Checkins
mailing list