[Checkins] SVN: zope.testing/branches/wosc-doctest-finder/ backmerge from trunk
Wolfgang Schnerring
wosc at wosc.de
Mon Oct 5 07:06:04 EDT 2009
Log message for revision 104792:
backmerge from trunk
Changed:
U zope.testing/branches/wosc-doctest-finder/CHANGES.txt
U zope.testing/branches/wosc-doctest-finder/setup.py
U zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/formatter.py
U zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/profiling.py
U zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/runner.py
U zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-layers-buff.txt
U zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-profiling.txt
U zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-test-selection.txt
-=-
Modified: zope.testing/branches/wosc-doctest-finder/CHANGES.txt
===================================================================
--- zope.testing/branches/wosc-doctest-finder/CHANGES.txt 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/CHANGES.txt 2009-10-05 11:06:04 UTC (rev 104792)
@@ -1,16 +1,31 @@
zope.testing Changelog
**********************
-3.8.2 (unreleased)
+3.8.4 (unreleased)
==================
-- Nothing changed yet.
+3.8.3 (2009-09-21)
+==================
+
+- Avoid a split() call or we get test failures when running from a directory
+ with spaces in it.
+
+- Fix testrunner behavior on Windows for -j2 (or greater) combined with -v
+ (or greater).
+
+3.8.2 (2009-09-15)
+==================
+
+- Removing hotshot profiler when using Python 2.6. That makes zope.testing
+ compatible with Python 2.6
+
+
3.8.1 (2009-08-12)
==================
-- Avoid hardcoding sys.argv[0] as script;
+- Avoid hardcoding sys.argv[0] as script;
allow, for instance, Zope 2's `bin/instance test` (LP#407916).
- Produce a clear error message when a subprocess doesn't follow the
@@ -24,7 +39,7 @@
- Include incremental output when there are multiple subprocesses and a
verbosity of -vv or greater is requested. This again is not batched,
- supporting automated processes and humans looking for hung tests.
+ supporting automated processes and humans looking for hung tests.
3.8.0 (2009-07-24)
Modified: zope.testing/branches/wosc-doctest-finder/setup.py
===================================================================
--- zope.testing/branches/wosc-doctest-finder/setup.py 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/setup.py 2009-10-05 11:06:04 UTC (rev 104792)
@@ -11,6 +11,11 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+# This package is developed by the Zope Toolkit project, documented here:
+# http://docs.zope.org/zopetoolkit
+# When developing and releasing this package, please follow the documented
+# Zope Toolkit policies as described by this documentation.
+##############################################################################
"""Setup for zope.testing package
$Id$
@@ -80,7 +85,7 @@
setup(
name='zope.testing',
- version = '3.8.2dev',
+ version = '3.8.4dev',
url='http://pypi.python.org/pypi/zope.testing',
license='ZPL 2.1',
description='Zope testing framework, including the testrunner script.',
Modified: zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/formatter.py
===================================================================
--- zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/formatter.py 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/formatter.py 2009-10-05 11:06:04 UTC (rev 104792)
@@ -266,7 +266,7 @@
elif self.verbose == 1:
sys.stdout.write('.' * test.countTestCases())
-
+
elif self.in_subprocess:
sys.stdout.write('.' * test.countTestCases())
# Give the parent process a new line so it sees the progress
Modified: zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/profiling.py
===================================================================
--- zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/profiling.py 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/profiling.py 2009-10-05 11:06:04 UTC (rev 104792)
@@ -55,36 +55,40 @@
# some Linux distributions don't include the profiler, which hotshot uses
-try:
- import hotshot
- import hotshot.stats
-except ImportError:
- pass
-else:
- class HotshotProfiler(object):
- """hotshot interface"""
+if not sys.hexversion >= 0x02060000:
+ # Hotshot is not maintained any longer in 2.6. It does not support
+ # merging to hotshot files. Thus we won't use it in python2.6 and
+ # onwards
+ try:
+ import hotshot
+ import hotshot.stats
+ except ImportError:
+ pass
+ else:
+ class HotshotProfiler(object):
+ """hotshot interface"""
- def __init__(self, filepath):
- self.profiler = hotshot.Profile(filepath)
- self.enable = self.profiler.start
- self.disable = self.profiler.stop
+ def __init__(self, filepath):
+ self.profiler = hotshot.Profile(filepath)
+ self.enable = self.profiler.start
+ self.disable = self.profiler.stop
+
+ def finish(self):
+ self.profiler.close()
- def finish(self):
- self.profiler.close()
+ def loadStats(self, prof_glob):
+ stats = None
+ for file_name in glob.glob(prof_glob):
+ loaded = hotshot.stats.load(file_name)
+ if stats is None:
+ stats = loaded
+ else:
+ stats.add(loaded)
+ return stats
- def loadStats(self, prof_glob):
- stats = None
- for file_name in glob.glob(prof_glob):
- loaded = hotshot.stats.load(file_name)
- if stats is None:
- stats = loaded
- else:
- stats.add(loaded)
- return stats
+ available_profilers['hotshot'] = HotshotProfiler
- available_profilers['hotshot'] = HotshotProfiler
-
class Profiling(zope.testing.testrunner.feature.Feature):
def __init__(self, runner):
Modified: zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/runner.py
===================================================================
--- zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/runner.py 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/runner.py 2009-10-05 11:06:04 UTC (rev 104792)
@@ -19,6 +19,7 @@
import subprocess
import cStringIO
+import errno
import gc
import Queue
import re
@@ -481,7 +482,7 @@
class DeferredSubprocessResult(AbstractSubprocessResult):
"""Keeps stdout around for later processing,"""
-
+
def write(self, out):
if not _is_dots(out):
self.stdout.append(out)
@@ -496,7 +497,7 @@
sys.stdout.flush()
-_is_dots = re.compile(r'\.+\n').match
+_is_dots = re.compile(r'\.+(\r\n?|\n)').match # Windows sneaks in a \r\n.
class KeepaliveSubprocessResult(AbstractSubprocessResult):
"Keeps stdout for later processing; sends marks to queue to show activity."
@@ -506,7 +507,7 @@
self._done = value
assert value, 'Internal error: unexpectedly setting done to False'
self.queue.put((self.layer_name, ' LAYER FINISHED'))
- done = property(lambda self: self._done, _set_done)
+ done = property(lambda self: self._done, _set_done)
def write(self, out):
if _is_dots(out):
Modified: zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-layers-buff.txt
===================================================================
--- zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-layers-buff.txt 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-layers-buff.txt 2009-10-05 11:06:04 UTC (rev 104792)
@@ -68,13 +68,13 @@
>>> pause = datetime.timedelta(seconds=0.3)
>>> last_line, last_time = record.pop(0)
>>> for line, time in record:
- ... if (time-last_time >= pause and
- ... line != ' Running in a subprocess.\n'):
+ ... if time-last_time >= pause:
... # We paused!
... print 'PAUSE FOUND BETWEEN THESE LINES:'
... print ''.join([last_line, line, '-'*70])
... last_line, last_time = line, time
- PAUSE FOUND BETWEEN THESE LINES:
+ ... # doctest: +ELLIPSIS
+ PAUSE FOUND BETWEEN THESE LINES:...
Running:
test_something (sampletests_buffering.TestSomething2)
----------------------------------------------------------------------
@@ -126,13 +126,13 @@
>>> last_line, last_time = record.pop(0)
>>> for line, time in record:
- ... if (time-last_time >= pause and
- ... line != ' Running in a subprocess.\n'):
+ ... if time-last_time >= pause:
... # We paused!
... print 'PAUSE FOUND BETWEEN THIS OUTPUT:'
... print '\n'.join([last_line, line, '-'*70])
... last_line, last_time = line, time
- PAUSE FOUND BETWEEN THIS OUTPUT:
+ ... # doctest: +ELLIPSIS
+ PAUSE FOUND BETWEEN THIS OUTPUT:...
.
.
----------------------------------------------------------------------
Modified: zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-profiling.txt
===================================================================
--- zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-profiling.txt 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-profiling.txt 2009-10-05 11:06:04 UTC (rev 104792)
@@ -1,10 +1,16 @@
Profiling
=========
+The testrunner supports hotshot and cProfile profilers. Hotshot profiler
+support does not work with python2.6
+ >>> import os.path, sys
+ >>> profiler = '--profile=hotshot'
+ >>> if sys.hexversion >= 0x02060000:
+ ... profiler = '--profile=cProfile'
+
The testrunner includes the ability to profile the test execution with hotshot
-via the --profile option.
+via the --profile option, if it a python <= 2.6
- >>> import os.path, sys
>>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex')
>>> sys.path.append(directory_with_tests)
@@ -13,7 +19,7 @@
... '--tests-pattern', '^sampletestsf?$',
... ]
- >>> sys.argv = [testrunner_script, '--profile=hotshot']
+ >>> sys.argv = [testrunner_script, profiler]
When the tests are run, we get profiling output.
@@ -32,7 +38,7 @@
Profiling also works across layers.
- >>> sys.argv = [testrunner_script, '-ssample2', '--profile=hotshot',
+ >>> sys.argv = [testrunner_script, '-ssample2', profiler,
... '--tests-pattern', 'sampletests_ntd']
>>> testrunner.run_internal(defaults)
Running...
Modified: zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-test-selection.txt
===================================================================
--- zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-test-selection.txt 2009-10-05 11:05:51 UTC (rev 104791)
+++ zope.testing/branches/wosc-doctest-finder/src/zope/testing/testrunner/testrunner-test-selection.txt 2009-10-05 11:06:04 UTC (rev 104792)
@@ -161,7 +161,7 @@
tab-completion):
>>> subdir = os.path.join(directory_with_tests, 'sample1')
- >>> sys.argv = ('test --layer 122 -s %s -vv' % subdir).split()
+ >>> sys.argv = ['test', '--layer', '122', '-s', subdir, '-vv']
>>> from zope.testing import testrunner
>>> testrunner.run_internal(defaults)
Running tests at level 1
More information about the checkins
mailing list