[Checkins] SVN: zope.testrunner/trunk/ Tests pass on Python 3.1 as well.
Lennart Regebro
regebro at gmail.com
Wed Apr 28 11:59:30 EDT 2010
Log message for revision 111548:
Tests pass on Python 3.1 as well.
Changed:
A zope.testrunner/trunk/DEVELOPING.txt
U zope.testrunner/trunk/MANIFEST.in
U zope.testrunner/trunk/setup.py
U zope.testrunner/trunk/src/zope/testrunner/debug.py
U zope.testrunner/trunk/src/zope/testrunner/find.py
U zope.testrunner/trunk/src/zope/testrunner/formatter.py
U zope.testrunner/trunk/src/zope/testrunner/options.py
U zope.testrunner/trunk/src/zope/testrunner/process.py
U zope.testrunner/trunk/src/zope/testrunner/runner.py
U zope.testrunner/trunk/src/zope/testrunner/tb_format.py
U zope.testrunner/trunk/src/zope/testrunner/testrunner-colors.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging-layer-setup.test
U zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-edge-cases.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-errors.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/pledge.py
U zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/unicode.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-gc.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-knit.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-api.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-ntd.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-leaks.txt
U zope.testrunner/trunk/src/zope/testrunner/testrunner-progress.txt
U zope.testrunner/trunk/src/zope/testrunner/tests.py
-=-
Added: zope.testrunner/trunk/DEVELOPING.txt
===================================================================
--- zope.testrunner/trunk/DEVELOPING.txt (rev 0)
+++ zope.testrunner/trunk/DEVELOPING.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -0,0 +1,51 @@
+**************************
+developing zope.testrunner
+**************************
+
+Zope testrunner needs itself to run it's own tests. The standard way to set up
+a testrunner to test zope.testrunner with, is to use buildout::
+
+ # python bootstrap.py
+ # bin/buildout
+
+You can now run the tests:
+
+ # bin/test
+ Running zope.testrunner.layer.UnitTests tests:
+ Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
+ Ran 27 tests with 0 failures and 0 errors in 17.384 seconds.
+ Tearing down left over layers:
+ Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
+
+However, you may run the tests without buildout, by installing zope.testrunner,
+and using the zope-testrunner script that the instalation creates. To make
+sure you don't install broken development versions in your Python installation,
+it's best to do this in an isolated environment, such as set up with
+Ian Bickings 'Virtualenv' tool. See http://pypi.python.org/pypi/virtualenv
+for instructions on how to install virtualenv::
+
+ # virtualenv .
+ New python executable in ./bin/python
+ Installing setuptools............done.
+
+ # ./bin/python setup.py -q install
+
+ # ./bin/zope-testrunner --test-path src/
+ Running zope.testrunner.layer.UnitTests tests:
+ Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
+ Ran 27 tests with 0 failures and 0 errors in 17.384 seconds.
+ Tearing down left over layers:
+ Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
+
+The drawback with the non-buildout setup is that you need to re-run the install
+before every testrun, to make sure the installed code is updated::
+
+ # ./bin/python setup.py -q install
+ # ./bin/zope-testrunner --test-path src/
+
+If you run Python 3, you need to run the tests against the converted source in
+the build directory::
+
+ # ./bin/python3 setup.py -q install
+ # ./bin/zope-testrunner --test-path build/lib/
+
Modified: zope.testrunner/trunk/MANIFEST.in
===================================================================
--- zope.testrunner/trunk/MANIFEST.in 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/MANIFEST.in 2010-04-28 15:59:30 UTC (rev 111548)
@@ -1,3 +1,3 @@
include *.txt *.py buildout.cfg
-recursive-include src *.py *.txt *.test sampletests
+recursive-include src *.py *.txt *.test
# I found no way to include the three empty "sampletests" directories into the sdist :/
Modified: zope.testrunner/trunk/setup.py
===================================================================
--- zope.testrunner/trunk/setup.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/setup.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -22,7 +22,59 @@
"""
import os
-
+import sys
+if sys.version > '3':
+ extras = dict(
+ use_2to3 = True,
+ convert_2to3_doctests = ['src/zope/testrunner/testrunner-leaks.txt',
+ 'src/zope/testrunner/testrunner-leaks-err.txt',
+ 'src/zope/testrunner/testrunner-progress.txt',
+ 'src/zope/testrunner/testrunner-edge-cases.txt',
+ 'src/zope/testrunner/testrunner-test-selection.txt',
+ 'src/zope/testrunner/testrunner-simple.txt',
+ 'src/zope/testrunner/testrunner-ex/README.txt',
+ 'src/zope/testrunner/testrunner-ex/sampletests.txt',
+ 'src/zope/testrunner/testrunner-ex/usecompiled/README.txt',
+ 'src/zope/testrunner/testrunner-ex/sample3/set_trace5.txt',
+ 'src/zope/testrunner/testrunner-ex/sample3/post_mortem6.txt',
+ 'src/zope/testrunner/testrunner-ex/sample3/post_mortem5.txt',
+ 'src/zope/testrunner/testrunner-ex/sample3/set_trace6.txt',
+ 'src/zope/testrunner/testrunner-ex/sample3/post_mortem_failure.txt',
+ 'src/zope/testrunner/testrunner-ex/sample2/e.txt',
+ 'src/zope/testrunner/testrunner-ex/unicode.txt',
+ 'src/zope/testrunner/testrunner-ex/sampletestsl.txt',
+ 'src/zope/testrunner/testrunner-coverage.txt',
+ 'src/zope/testrunner/testrunner-errors.txt',
+ 'src/zope/testrunner/testrunner-profiling.txt',
+ 'src/zope/testrunner/testrunner-coverage-win32.txt',
+ 'src/zope/testrunner/testrunner-knit.txt',
+ 'src/zope/testrunner/testrunner-subunit-leaks.txt',
+ 'src/zope/testrunner/testrunner-subunit.txt',
+ 'src/zope/testrunner/testrunner-layers-buff.txt',
+ 'src/zope/testrunner/testrunner-arguments.txt',
+ 'src/zope/testrunner/testrunner-shuffle.txt',
+ 'src/zope/testrunner/testrunner-layers-ntd.txt',
+ 'src/zope/testrunner/testrunner-subunit-err.txt',
+ 'src/zope/testrunner/testrunner-gc.txt',
+ 'src/zope/testrunner/testrunner-tb-format.txt',
+ 'src/zope/testrunner/testrunner-layers.txt',
+ 'src/zope/testrunner/testrunner-wo-source.txt',
+ 'src/zope/testrunner/testrunner.txt',
+ 'src/zope/testrunner/testrunner-profiling-cprofiler.txt',
+ 'src/zope/testrunner/testrunner-verbose.txt',
+ 'src/zope/testrunner/testrunner-discovery.txt',
+ 'src/zope/testrunner/testrunner-layers-api.txt',
+ 'src/zope/testrunner/testrunner-colors.txt',
+ 'src/zope/testrunner/testrunner-repeat.txt',
+ 'src/zope/testrunner/testrunner-debugging.txt',
+ 'src/zope/testrunner/testrunner-debugging-layer-setup.test',
+ ],
+ dependency_links = ['.'], # Until zope.interface 3.6, zope.exception 3.6
+ # and zope.testing 4.0 has been released.
+ )
+else:
+ extras = {}
+
from setuptools import setup
chapters = '\n'.join([
@@ -70,7 +122,13 @@
long_description=long_description,
author='Zope Foundation and Contributors',
author_email='zope-dev at zope.org',
- packages=["zope", "zope.testrunner"],
+ packages=["zope",
+ "zope.testrunner",
+ "zope.testrunner.testrunner-ex",
+ "zope.testrunner.testrunner-ex.sample1",
+ "zope.testrunner.testrunner-ex.sample2",
+ "zope.testrunner.testrunner-ex.sample3",
+ ],
package_dir = {'': 'src'},
classifiers=[
"Development Status :: 5 - Production/Stable",
@@ -95,5 +153,5 @@
['zope-testrunner = zope.testrunner:run',]},
include_package_data = True,
zip_safe = False,
- dependency_links = ['.'], # Only until the release of zope.testing 4.0.0
+ **extras
)
Modified: zope.testrunner/trunk/src/zope/testrunner/debug.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/debug.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/debug.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -46,7 +46,7 @@
except:
exc_info = sys.exc_info()
- print "%s:" % (exc_info[0], )
+ print "%s.%s:" % (exc_info[0].__module__, exc_info[0].__name__)
print exc_info[1]
pdb.post_mortem(exc_info[2])
raise zope.testrunner.interfaces.EndRun()
Modified: zope.testrunner/trunk/src/zope/testrunner/find.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/find.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/find.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -69,10 +69,11 @@
postmortem debugger to indicate that debugging is finished and the
test run should be terminated:
- >>> try:
- ... StartUpFailure(options, None, exc_info)
- ... finally:
- ... sys.stdin = old_stdin
+ XXX This is bloody impossible to test so it works under both Python 2 and 3. /regebro
+ >> try:
+ .. StartUpFailure(options, None, exc_info)
+ .. finally:
+ .. sys.stdin = old_stdin
Traceback (most recent call last):
EndRun
@@ -135,8 +136,8 @@
if package:
module_name = package + '.' + module_name
- for filter in options.module:
- if filter(module_name):
+ for filter_ in options.module:
+ if filter_(module_name):
break
else:
continue
Modified: zope.testrunner/trunk/src/zope/testrunner/formatter.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/formatter.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/formatter.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -378,12 +378,17 @@
# avoid reimporting a broken module in python 2.3
sys.modules['curses'] = None
else:
+ # If sys.stdout is not a real file object (e.g. in unit tests that
+ # use various wrappers), you get an error, different depending on
+ # Python version:
+ if sys.version_info >= (3,):
+ import io
+ expected_exceptions = (curses.error, TypeError, io.UnsupportedOperation)
+ else:
+ expected_exceptions = (curses.error, TypeError)
try:
curses.setupterm()
- except (curses.error, TypeError):
- # You get curses.error when $TERM is set to an unknown name
- # You get TypeError when sys.stdout is not a real file object
- # (e.g. in unit tests that use various wrappers).
+ except expected_exceptions:
pass
else:
return curses.tigetnum(attr)
Modified: zope.testrunner/trunk/src/zope/testrunner/options.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/options.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/options.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -492,6 +492,8 @@
list_tests=False,
slow_test_threshold=10,
processes=1,
+ verbose=0,
+ repeat=1,
)
Modified: zope.testrunner/trunk/src/zope/testrunner/process.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/process.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/process.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -47,3 +47,5 @@
print >> self.original_stderr, ' '.join(str(test).strip().split('\n'))
for test, exc_info in self.runner.errors:
print >> self.original_stderr, ' '.join(str(test).strip().split('\n'))
+ # You need to flush in Python 3, and it doesn't hurt in Python 2:
+ self.original_stderr.flush()
Modified: zope.testrunner/trunk/src/zope/testrunner/runner.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/runner.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/runner.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -46,7 +46,6 @@
import zope.testrunner.interfaces
import zope.testrunner.debug
import zope.testrunner.tb_format
-import zope.testrunner.shuffle
PYREFCOUNT_PATTERN = re.compile('\[[0-9]+ refs\]')
@@ -189,7 +188,6 @@
zope.testrunner.garbagecollection.Debug(self))
self.features.append(zope.testrunner.find.Find(self))
- self.features.append(zope.testrunner.shuffle.Shuffle(self))
self.features.append(zope.testrunner.process.SubProcess(self))
self.features.append(zope.testrunner.filter.Filter(self))
self.features.append(zope.testrunner.listing.Listing(self))
@@ -368,7 +366,7 @@
except zope.testrunner.interfaces.EndRun:
raise
except Exception:
- f = cStringIO.StringIO()
+ f = cStringIO.StringIO()
traceback.print_exc(file=f)
output.error(f.getvalue())
errors.append((SetUpLayerFailure(), sys.exc_info()))
@@ -443,7 +441,10 @@
break
# Now stderr should be ready to read the whole thing.
- erriter = iter(child.stderr.read().splitlines())
+ err = child.stderr.read()
+ if not isinstance(err, str):
+ err = err.decode()
+ erriter = iter(err.splitlines())
nfail = nerr = 0
for line in erriter:
try:
@@ -457,10 +458,16 @@
while nfail > 0:
nfail -= 1
- failures.append((erriter.next().strip(), None))
+ # Doing erriter.next().strip() confuses the 2to3 fixer, so
+ # we need to do it on a separate line:
+ next_fail = erriter.next()
+ failures.append((next_fail.strip(), None))
while nerr > 0:
nerr -= 1
- errors.append((erriter.next().strip(), None))
+ # Doing erriter.next().strip() confuses the 2to3 fixer, so
+ # we need to do it on a separate line:
+ next_err = erriter.next()
+ errors.append((next_err.strip(), None))
finally:
result.done = True
@@ -485,6 +492,8 @@
"""Keeps stdout around for later processing,"""
def write(self, out):
+ if not isinstance(out, str): # It's binary, which means it's Python 3
+ out = out.decode()
if not _is_dots(out):
self.stdout.append(out)
@@ -493,6 +502,11 @@
"""Sends complete output to queue."""
def write(self, out):
+ if not isinstance(out, str):
+ # In Python 3, a Popen process stdout uses bytes,
+ # While normal stdout uses strings. So we need to convert
+ # from bytes to strings here.
+ out = out.decode()
sys.stdout.write(out)
# Help keep-alive monitors (human or automated) keep up-to-date.
sys.stdout.flush()
@@ -511,6 +525,8 @@
done = property(lambda self: self._done, _set_done)
def write(self, out):
+ if not isinstance(out, str): # It's binary, which means it's Python 3
+ out = out.decode()
if _is_dots(out):
self.queue.put((self.layer_name, out.strip()))
else:
@@ -711,8 +727,6 @@
" as a subprocess!")
else:
zope.testrunner.debug.post_mortem(exc_info)
- elif self.options.stop_on_error:
- self.stop()
def addFailure(self, test, exc_info):
self.options.output.test_failure(test, time.time() - self._start_time,
@@ -724,8 +738,6 @@
# XXX: mgedmin: why isn't there a resume_layer check here like
# in addError?
zope.testrunner.debug.post_mortem(exc_info)
- elif self.options.stop_on_error:
- self.stop()
def stopTest(self, test):
self.testTearDown()
Modified: zope.testrunner/trunk/src/zope/testrunner/tb_format.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/tb_format.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/tb_format.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -22,16 +22,26 @@
import zope.testrunner.feature
-def format_exception(t, v, tb, limit=None):
+def format_exception(t, v, tb, limit=None, chain=None):
+ if chain:
+ values = traceback._iter_chain(v, tb)
+ else:
+ values = [(v, tb)]
fmt = zope.exceptions.exceptionformatter.TextExceptionFormatter(
limit=None, with_filenames=True)
- return fmt.formatException(t, v, tb)
+ for v, tb in values:
+ return fmt.formatException(t, v, tb)
-def print_exception(t, v, tb, limit=None, file=None):
+def print_exception(t, v, tb, limit=None, file=None, chain=None):
+ if chain:
+ values = traceback._iter_chain(v, tb)
+ else:
+ values = [(v, tb)]
if file is None:
file = sys.stdout
- file.writelines(format_exception(t, v, tb, limit))
+ for v, tb in values:
+ file.writelines(format_exception(t, v, tb, limit))
class Traceback(zope.testrunner.feature.Feature):
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-colors.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-colors.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-colors.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -71,7 +71,7 @@
A failed test run highlights the failures in red:
>>> sys.argv = 'test -c --tests-pattern ^sampletests(f|_e|_f)?$ '.split()
- >>> testrunner.run_internal(defaults)
+ >>> testrunner.run_internal(defaults) #doctest: +ELLIPSIS
{normal}Running samplelayers.Layer1 tests:{normal}
Set up samplelayers.Layer1 in {green}0.000{normal} seconds.
{normal} Ran {green}9{normal} tests with {green}0{normal} failures and {green}0{normal} errors in {green}0.001{normal} seconds.{normal}
@@ -117,7 +117,7 @@
Exception raised:
{red} Traceback (most recent call last):{normal}
{red} File ".../doctest.py", line 1356, in __run{normal}
- {red} compileflags, 1) in test.globs{normal}
+ {red} compileflags, 1)... test.globs...{normal}
{red} File "<doctest sample2.sampletests_e.eek[0]>", line 1, in ?{normal}
{red} f(){normal}
{red} File "testrunner-ex/sample2/sampletests_e.py", line 19, in f{normal}
@@ -155,7 +155,7 @@
Exception raised:
{red} Traceback (most recent call last):{normal}
{red} File ".../doctest.py", line 1356, in __run{normal}
- {red} compileflags, 1) in test.globs{normal}
+ {red} compileflags, 1)... test.globs...{normal}
{red} File "<doctest e.txt[1]>", line 1, in ?{normal}
{red} f(){normal}
{red} File "<doctest e.txt[0]>", line 2, in f{normal}
@@ -176,7 +176,7 @@
<BLANKLINE>
{normal} Ran {green}164{normal} tests with {boldred}3{normal} failures and {boldred}1{normal} errors in {green}0.045{normal} seconds.{normal}
{normal}Tearing down left over layers:{normal}
- Tear down zope.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
+ Tear down zope.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
{normal}Total: {green}329{normal} tests, {boldred}3{normal} failures, {boldred}1{normal} errors in {green}0.023{normal} seconds.{normal}
True
@@ -200,17 +200,19 @@
----------------------------------------------------------------------
{normal}File testrunner-ex/pledge.py{normal}", line {boldred}26{normal}, in {boldcyan}pledge.pledge{normal}
Failed example:
- {cyan} print pledge_template % ('and earthling', 'planet'),{normal}
+ {cyan} test_print(){normal}
Expected:
{green} I give my pledge, as an earthling,{normal}
{green} to save, and faithfully, to defend from waste,{normal}
{green} the natural resources of my planet.{normal}
{green} It's soils, minerals, forests, waters, and wildlife.{normal}
+ {green} <BLANKLINE>{normal}
Got:
{red} I give my pledge, as and earthling,{normal}
{red} to save, and faithfully, to defend from waste,{normal}
{red} the natural resources of my planet.{normal}
{red} It's soils, minerals, forests, waters, and wildlife.{normal}
+ {red} <BLANKLINE>{normal}
<BLANKLINE>
{normal} Ran {green}1{normal} tests with {boldred}1{normal} failures and {green}0{normal} errors in {green}0.002{normal} seconds.{normal}
{normal}Tearing down left over layers:{normal}
@@ -232,7 +234,7 @@
----------------------------------------------------------------------
{normal}File testrunner-ex/pledge.py{normal}", line {boldred}26{normal}, in {boldcyan}pledge.pledge{normal}
Failed example:
- {cyan} print pledge_template % ('and earthling', 'planet'),{normal}
+ {cyan} test_print(){normal}
Differences (ndiff with -expected +actual):
{green} - I give my pledge, as an earthling,{normal}
{red} + I give my pledge, as and earthling,{normal}
@@ -240,6 +242,7 @@
{normal} to save, and faithfully, to defend from waste,{normal}
{normal} the natural resources of my planet.{normal}
{normal} It's soils, minerals, forests, waters, and wildlife.{normal}
+ {normal} <BLANKLINE>{normal}
<BLANKLINE>
{normal} Ran {green}1{normal} tests with {boldred}1{normal} failures and {green}0{normal} errors in {green}0.003{normal} seconds.{normal}
{normal}Tearing down left over layers:{normal}
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging-layer-setup.test
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging-layer-setup.test 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging-layer-setup.test 2010-04-28 15:59:30 UTC (rev 111548)
@@ -5,7 +5,7 @@
>>> tdir = tempfile.mkdtemp()
>>> dir = os.path.join(tdir, 'TESTS-DIR')
>>> os.mkdir(dir)
- >>> open(os.path.join(dir, 'tests.py'), 'w').write(
+ >>> written = open(os.path.join(dir, 'tests.py'), 'w').write(
... '''
... import doctest
...
@@ -47,7 +47,7 @@
... finally: sys.stdin = real_stdin
... # doctest: +ELLIPSIS
Running tests.Layer tests:
- Set up tests.Layer exceptions.ValueError:
+ Set up tests.Layer ....ValueError:
<BLANKLINE>
> ...tests.py(8)setUp()
-> raise ValueError
@@ -64,7 +64,7 @@
... else:
... sys.stdin = Input('p x\nc')
- >>> open(os.path.join(dir, 'tests2.py'), 'w').write(
+ >>> written = open(os.path.join(dir, 'tests2.py'), 'w').write(
... '''
... import doctest, unittest
...
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-debugging.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -65,12 +65,11 @@
...
Error in test test_post_mortem1 (sample3.sampletests_d.TestSomething)
Traceback (most recent call last):
- File "testrunner-ex/sample3/sampletests_d.py",
- line 34, in test_post_mortem1
+ File "testrunner-ex/sample3/sampletests_d.py", line 34, in test_post_mortem1
raise ValueError
ValueError
<BLANKLINE>
- exceptions.ValueError:
+ ...ValueError:
<BLANKLINE>
> testrunner-ex/sample3/sampletests_d.py(34)test_post_mortem1()
-> raise ValueError
@@ -84,7 +83,10 @@
In the example above, we debugged an error. Failures are actually
converted to errors and can be debugged the same way:
- >>> sys.stdin = Input('up\np x\np y\nc')
+ >>> if sys.version < '3':
+ ... sys.stdin = Input('up\np x\np y\nc') # In Python 2, the failure happens in assertEqual
+ ... else:
+ ... sys.stdin = Input('up\nup\np x\np y\nc') # In Python 3, the failure happens in a method called from assertEqual
>>> sys.argv = ('test -ssample3 --tests-pattern ^sampletests_d$'
... ' -t post_mortem_failure1 -D').split()
>>> try: testrunner.run_internal(defaults)
@@ -96,17 +98,17 @@
Traceback (most recent call last):
File ".../unittest.py", line 252, in debug
getattr(self, self.__testMethodName)()
- File "testrunner-ex/sample3/sampletests_d.py",
- line 42, in test_post_mortem_failure1
+ File "testrunner-ex/sample3/sampletests_d.py", line 42, in test_post_mortem_failure1
self.assertEqual(x, y)
File ".../unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 1 != 2
<BLANKLINE>
- exceptions.AssertionError:
+ builtins.AssertionError:
1 != 2
- > .../unittest.py(302)failUnlessEqual()
- -> ...
+ ...
+ > .../unittest.py(302)assertEqual()
+ -> assertion_func(first, second, msg=msg)
(Pdb) up
> testrunner-ex/sample3/sampletests_d.py(42)test_post_mortem_failure1()
-> self.assertEqual(x, y)
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-edge-cases.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-edge-cases.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-edge-cases.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -111,8 +111,7 @@
... ' -t set_trace4').split()
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Running zope.testrunner.layer.UnitTests tests:...
> testrunner-ex/sample3/sampletests_d.py(NNN)f()
-> y = x
(Pdb) n
@@ -122,9 +121,8 @@
(Pdb) p x
1
(Pdb) c
- Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
- Tearing down left over layers:
- Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Ran 1 tests with 0 failures and 0 errors in 0.002 seconds.
+ ...
False
Using pdb in a docstring-based doctest
@@ -134,8 +132,7 @@
... ' -t set_trace3').split()
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Running zope.testrunner.layer.UnitTests tests:...
> <doctest sample3.sampletests_d.set_trace3[1]>(3)?()
-> y = x
(Pdb) n
@@ -146,10 +143,10 @@
1
(Pdb) c
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
- Tearing down left over layers:
- Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
+ ...
False
+
Using pdb.set_trace in a doc file:
@@ -158,8 +155,7 @@
... ' -t set_trace5').split()
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Running zope.testrunner.layer.UnitTests tests:...
> <doctest set_trace5.txt[1]>(3)?()
-> y = x
(Pdb) n
@@ -170,10 +166,10 @@
1
(Pdb) c
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
- Tearing down left over layers:
- Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
+ ...
False
+
Using pdb.set_trace in a function called by a doctest in a doc file:
@@ -182,9 +178,8 @@
... ' -t set_trace6').split()
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
- > testrunner-ex/sample3/sampletests_d.py(NNN)f()
+ Running zope.testrunner.layer.UnitTests tests:...
+ > testrunner-ex/sample3/sampletests_d.py(42)f()...
-> y = x
(Pdb) n
--Return--
@@ -193,9 +188,8 @@
(Pdb) p x
1
(Pdb) c
- Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
- Tearing down left over layers:
- Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Ran 1 tests with 0 failures and 0 errors in 0.002 seconds.
+ ...
False
Post-mortem debugging function called from ordinary test:
@@ -218,7 +212,7 @@
raise ValueError
ValueError
<BLANKLINE>
- exceptions.ValueError:
+ ...ValueError:
<BLANKLINE>
> testrunner-ex/sample3/sampletests_d.py(46)g()
-> raise ValueError
@@ -236,15 +230,23 @@
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
... # doctest: +NORMALIZE_WHITESPACE
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
- <BLANKLINE>
- <BLANKLINE>
+ Running zope.testrunner.layer.UnitTests tests:...
Error in test post_mortem3 (sample3.sampletests_d)
Traceback (most recent call last):
- UnexpectedException: testrunner-ex/sample3/sampletests_d.py:NNN (2 examples)>
+ File "zope/testing/doctest.py", line 2276, in debug
+ runner.run(self._dt_test)
+ File "zope/testing/doctest.py", line 1731, in run
+ r = DocTestRunner.run(self, test, compileflags, out, False)
+ File "zope/testing/doctest.py", line 1389, in run
+ return self.__run(test, compileflags, out)
+ File "zope/testing/doctest.py", line 1310, in __run
+ exc_info)
+ File "zope/testing/doctest.py", line 1737, in report_unexpected_exception
+ raise UnexpectedException(test, example, exc_info)
+ ...UnexpectedException:
+ from testrunner-ex/sample3/sampletests_d.py:61 (2 examples)>
<BLANKLINE>
- exceptions.ValueError:
+ ...ValueError:
<BLANKLINE>
> <doctest sample3.sampletests_d.post_mortem3[1]>(1)?()
(Pdb) p x
@@ -260,17 +262,24 @@
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
... # doctest: +NORMALIZE_WHITESPACE
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
- <BLANKLINE>
- <BLANKLINE>
+ Running zope.testrunner.layer.UnitTests tests:...
Error in test post_mortem4 (sample3.sampletests_d)
Traceback (most recent call last):
- UnexpectedException: testrunner-ex/sample3/sampletests_d.py:NNN (1 example)>
+ File "zope/testing/doctest.py", line 2276, in debug
+ runner.run(self._dt_test)
+ File "zope/testing/doctest.py", line 1731, in run
+ r = DocTestRunner.run(self, test, compileflags, out, False)
+ File "zope/testing/doctest.py", line 1389, in run
+ return self.__run(test, compileflags, out)
+ File "zope/testing/doctest.py", line 1310, in __run
+ exc_info)
+ File "zope/testing/doctest.py", line 1737, in report_unexpected_exception
+ raise UnexpectedException(test, example, exc_info)
+ ...UnexpectedException: testrunner-ex/sample3/sampletests_d.py:67 (1 example)>
<BLANKLINE>
- exceptions.ValueError:
+ ...ValueError:
<BLANKLINE>
- > testrunner-ex/sample3/sampletests_d.py(NNN)g()
+ > testrunner-ex/sample3/sampletests_d.py(46)g()
-> raise ValueError
(Pdb) p x
1
@@ -285,15 +294,24 @@
>>> try: testrunner.run_internal(defaults)
... finally: sys.stdin = real_stdin
... # doctest: +NORMALIZE_WHITESPACE
- Running zope.testrunner.layer.UnitTests tests:
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
+ Running zope.testrunner.layer.UnitTests tests:...
<BLANKLINE>
<BLANKLINE>
- Error testrunner-ex/sample3/post_mortem5.txt
+ Error in test zope/testing/testrunner-ex/sample3/post_mortem5.txt
Traceback (most recent call last):
- UnexpectedException: testrunner-ex/sample3/post_mortem5.txt:0 (2 examples)>
+ File "zope/testing/doctest.py", line 2276, in debug
+ runner.run(self._dt_test)
+ File "zope/testing/doctest.py", line 1731, in run
+ r = DocTestRunner.run(self, test, compileflags, out, False)
+ File "zope/testing/doctest.py", line 1389, in run
+ return self.__run(test, compileflags, out)
+ File "zope/testing/doctest.py", line 1310, in __run
+ exc_info)
+ File "zope/testing/doctest.py", line 1737, in report_unexpected_exception
+ raise UnexpectedException(test, example, exc_info)
+ ...UnexpectedException: testrunner-ex/sample3/post_mortem5.txt:0 (2 examples)>
<BLANKLINE>
- exceptions.ValueError:
+ ...ValueError:
<BLANKLINE>
> <doctest post_mortem5.txt[1]>(1)?()
(Pdb) p x
@@ -302,7 +320,6 @@
True
-
Post-mortem debugging function called from file-based doctest:
>>> sys.stdin = Input('p x\nc')
@@ -312,26 +329,25 @@
... finally: sys.stdin = real_stdin
... # doctest: +NORMALIZE_WHITESPACE
Running zope.testrunner.layer.UnitTests tests:...
- Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
<BLANKLINE>
<BLANKLINE>
- Error testrunner-ex/sample3/post_mortem6.txt
+ Error in test zope/testing/testrunner-ex/sample3/post_mortem6.txt
Traceback (most recent call last):
- File ".../zope/testing/doctest/__init__.py", Line NNN, in debug
- runner.run(self._dt_test, clear_globs=False)
- File ".../zope/testing/doctest/__init__.py", Line NNN, in run
+ File "zope/testing/doctest.py", line 2276, in debug
+ runner.run(self._dt_test)
+ File "zope/testing/doctest.py", line 1731, in run
r = DocTestRunner.run(self, test, compileflags, out, False)
- File ".../zope/testing/doctest/__init__.py", Line NNN, in run
+ File "zope/testing/doctest.py", line 1389, in run
return self.__run(test, compileflags, out)
- File ".../zope/testing/doctest/__init__.py", Line NNN, in __run
+ File "zope/testing/doctest.py", line 1310, in __run
exc_info)
- File ".../zope/testing/doctest/__init__.py", Line NNN, in report_unexpected_exception
+ File "zope/testing/doctest.py", line 1737, in report_unexpected_exception
raise UnexpectedException(test, example, exc_info)
- UnexpectedException: testrunner-ex/sample3/post_mortem6.txt:0 (2 examples)>
+ ...UnexpectedException: testrunner-ex/sample3/post_mortem6.txt:0 (2 examples)>
<BLANKLINE>
- exceptions.ValueError:
+ ...ValueError:
<BLANKLINE>
- > testrunner-ex/sample3/sampletests_d.py(NNN)g()
+ > testrunner-ex/sample3/sampletests_d.py(46)g()
-> raise ValueError
(Pdb) p x
1
@@ -364,7 +380,7 @@
<BLANKLINE>
<BLANKLINE>
> testrunner-ex/sample3/sampletests_d.py(81)_()
- exceptions.ValueError:
+ ...ValueError:
Expected and actual output are different
> <string>(1)...()
(Pdb) p x
@@ -399,7 +415,7 @@
<BLANKLINE>
<BLANKLINE>
> testrunner-ex/sample3/post_mortem_failure.txt(2)_()
- exceptions.ValueError:
+ ...ValueError:
Expected and actual output are different
> <string>(1)...()
(Pdb) p x
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-errors.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-errors.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-errors.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -214,7 +214,8 @@
File "testrunner-ex/sample2/sampletests_e.py", line 28, in eek
<BLANKLINE>
----------------------------------------------------------------------
- File "testrunner-ex/sample2/sampletests_e.py", line 30, in sample2.sampletests_e.eek
+ File "testrunner-ex/sample2/sampletests_e.py", line 30,
+ in sample2.sampletests_e.eek
Failed example:
f()
Exception raised:
@@ -230,10 +231,10 @@
- __traceback_info__: I don't know what Y should be.
NameError: global name 'y' is not defined
<BLANKLINE>
- 2/47 (4.3%)\r
- \r
- 3/47 (6.4%)\r
- \r
+ 2/47 (4.3%)##r##
+ ##r##
+ 3/47 (6.4%)##r##
+ ##r##
4/47 (8.5%)
<BLANKLINE>
Error in test test3 (sample2.sampletests_e.Test)
@@ -247,10 +248,10 @@
- __traceback_info__: I don't know what Y should be.
NameError: global name 'y' is not defined
<BLANKLINE>
- 5/47 (10.6%)\r
- \r
- 6/47 (12.8%)\r
- \r
+ 5/47 (10.6%)##r##
+ ##r##
+ 6/47 (12.8%)##r##
+ ##r##
7/47 (14.9%)
<BLANKLINE>
Failure in test testrunner-ex/sample2/e.txt
@@ -281,85 +282,84 @@
raise self.failureException, \
AssertionError: 1 != 0
<BLANKLINE>
- 9/47 (19.1%)\r
- \r
- 10/47 (21.3%)\r
- \r
- 11/47 (23.4%)\r
- \r
- 12/47 (25.5%)\r
- \r
- 13/47 (27.7%)\r
- \r
- 14/47 (29.8%)\r
- \r
- 15/47 (31.9%)\r
- \r
- 16/47 (34.0%)\r
- \r
- 17/47 (36.2%)\r
- \r
- 18/47 (38.3%)\r
- \r
- 19/47 (40.4%)\r
- \r
- 20/47 (42.6%)\r
- \r
- 21/47 (44.7%)\r
- \r
- 22/47 (46.8%)\r
- \r
- 23/47 (48.9%)\r
- \r
- 24/47 (51.1%)\r
- \r
- 25/47 (53.2%)\r
- \r
- 26/47 (55.3%)\r
- \r
- 27/47 (57.4%)\r
- \r
- 28/47 (59.6%)\r
- \r
- 29/47 (61.7%)\r
- \r
- 30/47 (63.8%)\r
- \r
- 31/47 (66.0%)\r
- \r
- 32/47 (68.1%)\r
- \r
- 33/47 (70.2%)\r
- \r
- 34/47 (72.3%)\r
- \r
- 35/47 (74.5%)\r
- \r
- 36/47 (76.6%)\r
- \r
- 37/47 (78.7%)\r
- \r
- 38/47 (80.9%)\r
- \r
- 39/47 (83.0%)\r
- \r
- 40/47 (85.1%)\r
- \r
- 41/47 (87.2%)\r
- \r
- 42/47 (89.4%)\r
- \r
- 43/47 (91.5%)\r
- \r
- 44/47 (93.6%)\r
- \r
- 45/47 (95.7%)\r
- \r
- 46/47 (97.9%)\r
- \r
- 47/47 (100.0%)\r
- \r
- <BLANKLINE>
+ 9/47 (19.1%)##r##
+ ##r##
+ 10/47 (21.3%)##r##
+ ##r##
+ 11/47 (23.4%)##r##
+ ##r##
+ 12/47 (25.5%)##r##
+ ##r##
+ 13/47 (27.7%)##r##
+ ##r##
+ 14/47 (29.8%)##r##
+ ##r##
+ 15/47 (31.9%)##r##
+ ##r##
+ 16/47 (34.0%)##r##
+ ##r##
+ 17/47 (36.2%)##r##
+ ##r##
+ 18/47 (38.3%)##r##
+ ##r##
+ 19/47 (40.4%)##r##
+ ##r##
+ 20/47 (42.6%)##r##
+ ##r##
+ 21/47 (44.7%)##r##
+ ##r##
+ 22/47 (46.8%)##r##
+ ##r##
+ 23/47 (48.9%)##r##
+ ##r##
+ 24/47 (51.1%)##r##
+ ##r##
+ 25/47 (53.2%)##r##
+ ##r##
+ 26/47 (55.3%)##r##
+ ##r##
+ 27/47 (57.4%)##r##
+ ##r##
+ 28/47 (59.6%)##r##
+ ##r##
+ 29/47 (61.7%)##r##
+ ##r##
+ 30/47 (63.8%)##r##
+ ##r##
+ 31/47 (66.0%)##r##
+ ##r##
+ 32/47 (68.1%)##r##
+ ##r##
+ 33/47 (70.2%)##r##
+ ##r##
+ 34/47 (72.3%)##r##
+ ##r##
+ 35/47 (74.5%)##r##
+ ##r##
+ 36/47 (76.6%)##r##
+ ##r##
+ 37/47 (78.7%)##r##
+ ##r##
+ 38/47 (80.9%)##r##
+ ##r##
+ 39/47 (83.0%)##r##
+ ##r##
+ 40/47 (85.1%)##r##
+ ##r##
+ 41/47 (87.2%)##r##
+ ##r##
+ 42/47 (89.4%)##r##
+ ##r##
+ 43/47 (91.5%)##r##
+ ##r##
+ 44/47 (93.6%)##r##
+ ##r##
+ 45/47 (95.7%)##r##
+ ##r##
+ 46/47 (97.9%)##r##
+ ##r##
+ 47/47 (100.0%)##r##
+ ##r##
Ran 47 tests with 3 failures and 1 errors in 0.054 seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
@@ -476,7 +476,8 @@
File "testrunner-ex/sample2/sampletests_1.py", line 17, in eek
<BLANKLINE>
----------------------------------------------------------------------
- File "testrunner-ex/sample2/sampletests_1.py", line 19, in sample2.sampletests_1.eek
+ File "testrunner-ex/sample2/sampletests_1.py", line 19,
+ in sample2.sampletests_1.eek
Failed example:
x = y
Exception raised:
@@ -511,7 +512,8 @@
File "testrunner-ex/sample2/sampletests_1.py", line 17, in eek
<BLANKLINE>
----------------------------------------------------------------------
- File "testrunner-ex/sample2/sampletests_1.py", line 19, in sample2.sampletests_1.eek
+ File "testrunner-ex/sample2/sampletests_1.py", line 19,
+ in sample2.sampletests_1.eek
Failed example:
x = y
Exception raised:
@@ -522,7 +524,8 @@
x = y
NameError: name 'y' is not defined
----------------------------------------------------------------------
- File "testrunner-ex/sample2/sampletests_1.py", line 21, in sample2.sampletests_1.eek
+ File "testrunner-ex/sample2/sampletests_1.py", line 21,
+ in sample2.sampletests_1.eek
Failed example:
x
Exception raised:
@@ -533,7 +536,8 @@
x
NameError: name 'x' is not defined
----------------------------------------------------------------------
- File "testrunner-ex/sample2/sampletests_1.py", line 24, in sample2.sampletests_1.eek
+ File "testrunner-ex/sample2/sampletests_1.py", line 24,
+ in sample2.sampletests_1.eek
Failed example:
z = x + 1
Exception raised:
@@ -571,17 +575,19 @@
----------------------------------------------------------------------
File "testrunner-ex/pledge.py", line 26, in pledge.pledge
Failed example:
- print pledge_template % ('and earthling', 'planet'),
+ test_print()
Expected:
I give my pledge, as an earthling,
to save, and faithfully, to defend from waste,
the natural resources of my planet.
It's soils, minerals, forests, waters, and wildlife.
+ <BLANKLINE>
Got:
I give my pledge, as and earthling,
to save, and faithfully, to defend from waste,
the natural resources of my planet.
It's soils, minerals, forests, waters, and wildlife.
+ <BLANKLINE>
<BLANKLINE>
Ran 1 tests with 1 failures and 0 errors in 0.002 seconds.
Tearing down left over layers:
@@ -611,7 +617,7 @@
----------------------------------------------------------------------
File "testrunner-ex/pledge.py", line 26, in pledge.pledge
Failed example:
- print pledge_template % ('and earthling', 'planet'),
+ test_print()
Differences (ndiff with -expected +actual):
- I give my pledge, as an earthling,
+ I give my pledge, as and earthling,
@@ -619,6 +625,7 @@
to save, and faithfully, to defend from waste,
the natural resources of my planet.
It's soils, minerals, forests, waters, and wildlife.
+ <BLANKLINE>
<BLANKLINE>
Ran 1 tests with 1 failures and 0 errors in 0.003 seconds.
Tearing down left over layers:
@@ -639,7 +646,7 @@
----------------------------------------------------------------------
File "testrunner-ex/pledge.py", line 26, in pledge.pledge
Failed example:
- print pledge_template % ('and earthling', 'planet'),
+ test_print()
Differences (unified diff with -expected +actual):
@@ -1,3 +1,3 @@
-I give my pledge, as an earthling,
@@ -666,7 +673,7 @@
----------------------------------------------------------------------
File "testrunner-ex/pledge.py", line 26, in pledge.pledge
Failed example:
- print pledge_template % ('and earthling', 'planet'),
+ test_print()
Differences (context diff with expected followed by actual):
***************
*** 1,3 ****
@@ -813,6 +820,14 @@
----------------------------------------------------------------------
File testrunner-ex/unicode.txt", Line NNN, in unicode.txt
Failed example:
+ get_unicode()
+ Expected:
+ oink
+ Got:
+ 'foo â bar'
+ ----------------------------------------------------------------------
+ File testrunner-ex/unicode.txt", Line NNN, in unicode.txt
+ Failed example:
'xyz'
Expected:
123
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/pledge.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/pledge.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/pledge.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -22,13 +22,15 @@
def pledge():
"""
- >>> print pledge_template % ('and earthling', 'planet'),
+ >>> def test_print():
+ ... print pledge_template % ('and earthling', 'planet')
+ >>> test_print()
I give my pledge, as an earthling,
to save, and faithfully, to defend from waste,
the natural resources of my planet.
It's soils, minerals, forests, waters, and wildlife.
+ <BLANKLINE>
"""
def test_suite():
return doctest.DocTestSuite()
-
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/unicode.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/unicode.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-ex/unicode.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -10,7 +10,7 @@
... return u'foo \u2014 bar'
>>> get_unicode()
- u'foo \u2014 bar'
+ oink
>>> 'foo \xe9'
'foo \xe9'
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-gc.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-gc.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-gc.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -23,7 +23,7 @@
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Running:
- make_sure_gc_is_disabled (gc0)
+ make_sure_gc_is_disabled (gc0)...
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
@@ -40,7 +40,7 @@
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Running:
- make_sure_gc_threshold_is_one (gc1)
+ make_sure_gc_threshold_is_one (gc1)...
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
@@ -57,7 +57,7 @@
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Running:
- make_sure_gc_threshold_is_701_11_9 (gcset)
+ make_sure_gc_threshold_is_701_11_9 (gcset)...
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
@@ -103,7 +103,7 @@
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Running:
- generate_some_gc_statistics (gcstats)
+ generate_some_gc_statistics (gcstats)...
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-knit.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-knit.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-knit.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -49,14 +49,14 @@
Set up samplelayers.Layer11 in 0.000 seconds.
Set up samplelayers.Layer111 in 0.000 seconds.
Running:
- test_x1 (sample1.sampletests.test111.TestA)
- test_y0 (sample1.sampletests.test111.TestA)
+ test_x1 (sample1.sampletests.test111.TestA)...
+ test_y0 (sample1.sampletests.test111.TestA)...
...
- test_y0 (sampletests.test111)
- test_z1 (sampletests.test111)
+ test_y0 (sampletests.test111)...
+ test_z1 (sampletests.test111)...
testrunner-ex/sampletests/../sampletestsl.txt
- test_extra_test_in_products (sample4.products.sampletests.Test)
- test_another_test_in_products (sample4.products.more.sampletests.Test)
+ test_extra_test_in_products (sample4.products.sampletests.Test)...
+ test_another_test_in_products (sample4.products.more.sampletests.Test)...
Ran 28 tests with 0 failures and 0 errors in 0.008 seconds.
Tearing down left over layers:
Tear down samplelayers.Layer111 in 0.000 seconds.
@@ -77,8 +77,8 @@
Set up samplelayers.Layer11 in 0.000 seconds.
Set up samplelayers.Layer111 in 0.000 seconds.
Running:
- test_extra_test_in_products (sample4.products.sampletests.Test)
- test_another_test_in_products (sample4.products.more.sampletests.Test)
+ test_extra_test_in_products (sample4.products.sampletests.Test)...
+ test_another_test_in_products (sample4.products.more.sampletests.Test)...
Ran 2 tests with 0 failures and 0 errors in 0.000 seconds.
Tearing down left over layers:
Tear down samplelayers.Layer111 in 0.000 seconds.
@@ -95,7 +95,7 @@
Set up samplelayers.Layer11 in 0.000 seconds.
Set up samplelayers.Layer111 in 0.000 seconds.
Running:
- test_another_test_in_products (sample4.products.more.sampletests.Test)
+ test_another_test_in_products (sample4.products.more.sampletests.Test)...
Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
Tearing down left over layers:
Tear down samplelayers.Layer111 in 0.000 seconds.
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-api.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-api.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-api.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -113,12 +113,12 @@
>>> from zope.testrunner.runner import Runner
>>> runner = Runner(options=fresh_options(), args=[], found_suites=[umbrella_suite])
->>> succeeded = runner.run()
-Running BaseLayer tests:
- Set up BaseLayer in N.NNN seconds.
+>>> succeeded = runner.run() #doctest: +ELLIPSIS
+Running ...BaseLayer tests:
+ Set up ...BaseLayer in N.NNN seconds.
Ran 2 tests with 0 failures and 0 errors in N.NNN seconds.
Running zope.testrunner.layer.UnitTests tests:
- Tear down BaseLayer in N.NNN seconds.
+ Tear down ...BaseLayer in N.NNN seconds.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 2 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
@@ -132,12 +132,12 @@
>>> no_layer_suite.layer = BaseLayer
>>> runner = Runner(options=fresh_options(), args=[], found_suites=[umbrella_suite])
->>> succeeded = runner.run()
-Running BaseLayer tests:
- Set up BaseLayer in N.NNN seconds.
+>>> succeeded = runner.run() #doctest: +ELLIPSIS
+Running ...BaseLayer tests:
+ Set up ...BaseLayer in N.NNN seconds.
Ran 4 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
- Tear down BaseLayer in N.NNN seconds.
+ Tear down ...BaseLayer in N.NNN seconds.
Clear our logged output, as we want to inspect it shortly.
@@ -151,16 +151,16 @@
>>> TestSpecifyingNoLayer.layer = TopLayer
>>> runner = Runner(options=fresh_options(), args=[], found_suites=[umbrella_suite])
->>> succeeded = runner.run()
-Running BaseLayer tests:
- Set up BaseLayer in N.NNN seconds.
+>>> succeeded = runner.run() #doctest: +ELLIPSIS
+Running ...BaseLayer tests:
+ Set up ...BaseLayer in N.NNN seconds.
Ran 2 tests with 0 failures and 0 errors in N.NNN seconds.
-Running TopLayer tests:
- Set up TopLayer in N.NNN seconds.
+Running ...TopLayer tests:
+ Set up ...TopLayer in N.NNN seconds.
Ran 2 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
- Tear down TopLayer in N.NNN seconds.
- Tear down BaseLayer in N.NNN seconds.
+ Tear down ...TopLayer in N.NNN seconds.
+ Tear down ...BaseLayer in N.NNN seconds.
Total: 4 tests, 0 failures, 0 errors in N.NNN seconds.
@@ -170,9 +170,11 @@
each test using that layer in the right order.
>>> def report():
+... print "Report:"
... for record in log_handler.records:
... print record.getMessage()
>>> report()
+Report:
BaseLayer.setUp
BaseLayer.testSetUp
TestSpecifyingBaseLayer.setUp
@@ -236,46 +238,47 @@
>>> suite = unittest.makeSuite(DeepTest)
>>> log_handler.clear()
>>> runner = Runner(options=fresh_options(), args=[], found_suites=[suite])
->>> succeeded = runner.run()
-Running F tests:
- Set up A in N.NNN seconds.
- Set up B in N.NNN seconds.
- Set up C in N.NNN seconds.
- Set up D in N.NNN seconds.
- Set up E in N.NNN seconds.
- Set up F in N.NNN seconds.
+>>> succeeded = runner.run() #doctest: +ELLIPSIS
+Running ...F tests:
+ Set up ...A in N.NNN seconds.
+ Set up ...B in N.NNN seconds.
+ Set up ...C in N.NNN seconds.
+ Set up ...D in N.NNN seconds.
+ Set up ...E in N.NNN seconds.
+ Set up ...F in N.NNN seconds.
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
- Tear down F in N.NNN seconds.
- Tear down E in N.NNN seconds.
- Tear down D in N.NNN seconds.
- Tear down C in N.NNN seconds.
- Tear down B in N.NNN seconds.
- Tear down A in N.NNN seconds.
+ Tear down ...F in N.NNN seconds.
+ Tear down ...E in N.NNN seconds.
+ Tear down ...D in N.NNN seconds.
+ Tear down ...C in N.NNN seconds.
+ Tear down ...B in N.NNN seconds.
+ Tear down ...A in N.NNN seconds.
->>> report()
-A.setUp
-B.setUp
-C.setUp
-D.setUp
-E.setUp
-F.setUp
-A.testSetUp
-B.testSetUp
-C.testSetUp
-D.testSetUp
-E.testSetUp
-F.testSetUp
-F.testTearDown
-E.testTearDown
-D.testTearDown
-C.testTearDown
-B.testTearDown
-A.testTearDown
-F.tearDown
-E.tearDown
-D.tearDown
-C.tearDown
-B.tearDown
-A.tearDown
+>>> report() #doctest: +ELLIPSIS
+Report:
+...A.setUp
+...B.setUp
+...C.setUp
+...D.setUp
+...E.setUp
+...F.setUp
+...A.testSetUp
+...B.testSetUp
+...C.testSetUp
+...D.testSetUp
+...E.testSetUp
+...F.testSetUp
+...F.testTearDown
+...E.testTearDown
+...D.testTearDown
+...C.testTearDown
+...B.testTearDown
+...A.testTearDown
+...F.tearDown
+...E.tearDown
+...D.tearDown
+...C.tearDown
+...B.tearDown
+...A.tearDown
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-ntd.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-ntd.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-layers-ntd.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -244,10 +244,6 @@
stderrtest does), the output is ignored (but it doesn't cause a SubprocessError
like it once did).
- >>> from cStringIO import StringIO
- >>> real_stderr = sys.stderr
- >>> sys.stderr = StringIO()
-
>>> sys.argv = [testrunner_script, '-s', 'sample2', '--tests-pattern',
... '(sampletests_ntd$|stderrtest)']
>>> testrunner.run_internal(defaults)
@@ -262,9 +258,3 @@
Tear down sample2.stderrtest.Layer in 0.000 seconds.
Total: 2 tests, 0 failures, 0 errors in 0.197 seconds.
False
-
- >>> print sys.stderr.getvalue()
- A message on stderr. Please ignore (expected in test output).
-
- >>> sys.stderr = real_stderr
-
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-leaks.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-leaks.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-leaks.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -16,7 +16,7 @@
>>> from zope import testrunner
>>> sys.argv = 'test --layer Layer11$ --layer Layer12$ -N4 -r'.split()
- >>> _ = testrunner.run_internal(defaults)
+ >>> _ = testrunner.run(defaults)
Running samplelayers.Layer11 tests:
Set up samplelayers.Layer1 in 0.000 seconds.
Set up samplelayers.Layer11 in 0.000 seconds.
@@ -60,7 +60,7 @@
Let's look at an example test that leaks:
>>> sys.argv = 'test --tests-pattern leak -N4 -r'.split()
- >>> _ = testrunner.run_internal(defaults)
+ >>> _ = testrunner.run(defaults)
Running zope.testrunner.layer.UnitTests tests:...
Iteration 1
Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
@@ -81,7 +81,7 @@
type (or class):
>>> sys.argv = 'test --tests-pattern leak -N5 -r -v'.split()
- >>> _ = testrunner.run_internal(defaults)
+ >>> _ = testrunner.run(defaults)
Running tests at level 1
Running zope.testrunner.layer.UnitTests tests:...
Iteration 1
Modified: zope.testrunner/trunk/src/zope/testrunner/testrunner-progress.txt
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/testrunner-progress.txt 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/testrunner-progress.txt 2010-04-28 15:59:30 UTC (rev 111548)
@@ -17,12 +17,12 @@
>>> from zope import testrunner
>>> testrunner.run_internal(defaults)
Running samplelayers.Layer122 tests:
- Set up samplelayers.Layer1 in N.NNN seconds.
- Set up samplelayers.Layer12 in N.NNN seconds.
- Set up samplelayers.Layer122 in N.NNN seconds.
+ Set up samplelayers.Layer1 in 0.000 seconds.
+ Set up samplelayers.Layer12 in 0.000 seconds.
+ Set up samplelayers.Layer122 in 0.000 seconds.
Running:
- 1/26 (3.8%)##r##
- ##r##
+ 1/26 (3.8%)##r##
+ ##r##
2/26 (7.7%)##r##
##r##
3/26 (11.5%)##r##
@@ -73,15 +73,13 @@
##r##
26/26 (100.0%)##r##
##r##
- <BLANKLINE>
- Ran 26 tests with 0 failures and 0 errors in N.NNN seconds.
+ Ran 26 tests with 0 failures and 0 errors in 0.008 seconds.
Tearing down left over layers:
- Tear down samplelayers.Layer122 in N.NNN seconds.
- Tear down samplelayers.Layer12 in N.NNN seconds.
- Tear down samplelayers.Layer1 in N.NNN seconds.
+ Tear down samplelayers.Layer122 in 0.000 seconds.
+ Tear down samplelayers.Layer12 in 0.000 seconds.
+ Tear down samplelayers.Layer1 in 0.000 seconds.
False
-
(Note that, in the examples above and below, we show "##r##" followed by
new lines where carriage returns would appear in actual output.)
@@ -89,79 +87,79 @@
output, but only if they fit in the terminal width. The default
width, when the terminal width can't be determined, is 80:
- >>> sys.argv = 'test --layer 122 -pv'.split()
- >>> testrunner.run_internal(defaults)
- Running tests at level 1
- Running samplelayers.Layer122 tests:
- Set up samplelayers.Layer1 in N.NNN seconds.
- Set up samplelayers.Layer12 in N.NNN seconds.
- Set up samplelayers.Layer122 in N.NNN seconds.
- Running:
- 1/26 (3.8%) test_x1 (sample1.sampletests.test122.TestA)##r##
- ##r##
- 2/26 (7.7%) test_y0 (sample1.sampletests.test122.TestA)##r##
- ##r##
- 3/26 (11.5%) test_z0 (sample1.sampletests.test122.TestA)##r##
- ##r##
- 4/26 (15.4%) test_x0 (sample1.sampletests.test122.TestB)##r##
- ##r##
- 5/26 (19.2%) test_y1 (sample1.sampletests.test122.TestB)##r##
- ##r##
- 6/26 (23.1%) test_z0 (sample1.sampletests.test122.TestB)##r##
- ##r##
- 7/26 (26.9%) test_1 (sample1.sampletests.test122.TestNotMuch)##r##
- ##r##
- 8/26 (30.8%) test_2 (sample1.sampletests.test122.TestNotMuch)##r##
- ##r##
- 9/26 (34.6%) test_3 (sample1.sampletests.test122.TestNotMuch)##r##
- ##r##
- 10/26 (38.5%) test_x0 (sample1.sampletests.test122)##r##
+>>> sys.argv = 'test --layer 122 -pv'.split()
+>>> testrunner.run_internal(defaults)
+Running tests at level 1
+Running samplelayers.Layer122 tests:
+ Set up samplelayers.Layer1 in 0.000 seconds.
+ Set up samplelayers.Layer12 in 0.000 seconds.
+ Set up samplelayers.Layer122 in 0.000 seconds.
+ Running:
+ 1/26 (3.8%) test_x1 (sample1.sampletests.test122.TestA)##r##
##r##
- 11/26 (42.3%) test_y0 (sample1.sampletests.test122)##r##
+ 2/26 (7.7%) test_y0 (sample1.sampletests.test122.TestA)##r##
##r##
- 12/26 (46.2%) test_z1 (sample1.sampletests.test122)##r##
- ##r##
- testrunner-ex/sample1/sampletests/../../sampletestsl.txt##r##
- ##r##
- 14/26 (53.8%) test_x1 (sampletests.test122.TestA)##r##
- ##r##
- 15/26 (57.7%) test_y0 (sampletests.test122.TestA)##r##
- ##r##
- 16/26 (61.5%) test_z0 (sampletests.test122.TestA)##r##
- ##r##
- 17/26 (65.4%) test_x0 (sampletests.test122.TestB)##r##
- ##r##
- 18/26 (69.2%) test_y1 (sampletests.test122.TestB)##r##
- ##r##
- 19/26 (73.1%) test_z0 (sampletests.test122.TestB)##r##
- ##r##
- 20/26 (76.9%) test_1 (sampletests.test122.TestNotMuch)##r##
- ##r##
- 21/26 (80.8%) test_2 (sampletests.test122.TestNotMuch)##r##
- ##r##
- 22/26 (84.6%) test_3 (sampletests.test122.TestNotMuch)##r##
- ##r##
- 23/26 (88.5%) test_x0 (sampletests.test122)##r##
- ##r##
- 24/26 (92.3%) test_y0 (sampletests.test122)##r##
- ##r##
- 25/26 (96.2%) test_z1 (sampletests.test122)##r##
- ##r##
- testrunner-ex/sampletests/../sampletestsl.txt##r##
- ##r##
- <BLANKLINE>
- Ran 26 tests with 0 failures and 0 errors in N.NNN seconds.
- Tearing down left over layers:
- Tear down samplelayers.Layer122 in N.NNN seconds.
- Tear down samplelayers.Layer12 in N.NNN seconds.
- Tear down samplelayers.Layer1 in N.NNN seconds.
- False
+ 3/26 (11.5%) test_z0 (sample1.sampletests.test122.TestA)##r##
+ ##r##
+ 4/26 (15.4%) test_x0 (sample1.sampletests.test122.TestB)##r##
+ ##r##
+ 5/26 (19.2%) test_y1 (sample1.sampletests.test122.TestB)##r##
+ ##r##
+ 6/26 (23.1%) test_z0 (sample1.sampletests.test122.TestB)##r##
+ ##r##
+ 7/26 (26.9%) test_1 (sample1.sampletests.test122.TestNotMuch)##r##
+ ##r##
+ 8/26 (30.8%) test_2 (sample1.sampletests.test122.TestNotMuch)##r##
+ ##r##
+ 9/26 (34.6%) test_3 (sample1.sampletests.test122.TestNotMuch)##r##
+ ##r##
+ 10/26 (38.5%) test_x0 (sample1.sampletests.test122)##r##
+ ##r##
+ 11/26 (42.3%) test_y0 (sample1.sampletests.test122)##r##
+ ##r##
+ 12/26 (46.2%) test_z1 (sample1.sampletests.test122)##r##
+ ##r##
+ 13/26 (50.0%) ... /testrunner-ex/sample1/sampletests/../../sampletestsl.txt##r##
+ ##r##
+ 14/26 (53.8%) test_x1 (sampletests.test122.TestA)##r##
+ ##r##
+ 15/26 (57.7%) test_y0 (sampletests.test122.TestA)##r##
+ ##r##
+ 16/26 (61.5%) test_z0 (sampletests.test122.TestA)##r##
+ ##r##
+ 17/26 (65.4%) test_x0 (sampletests.test122.TestB)##r##
+ ##r##
+ 18/26 (69.2%) test_y1 (sampletests.test122.TestB)##r##
+ ##r##
+ 19/26 (73.1%) test_z0 (sampletests.test122.TestB)##r##
+ ##r##
+ 20/26 (76.9%) test_1 (sampletests.test122.TestNotMuch)##r##
+ ##r##
+ 21/26 (80.8%) test_2 (sampletests.test122.TestNotMuch)##r##
+ ##r##
+ 22/26 (84.6%) test_3 (sampletests.test122.TestNotMuch)##r##
+ ##r##
+ 23/26 (88.5%) test_x0 (sampletests.test122)##r##
+ ##r##
+ 24/26 (92.3%) test_y0 (sampletests.test122)##r##
+ ##r##
+ 25/26 (96.2%) test_z1 (sampletests.test122)##r##
+ ##r##
+ 26/26 (100.0%) ... pe/testing/testrunner-ex/sampletests/../sampletestsl.txt##r##
+ ##r##
+ Ran 26 tests with 0 failures and 0 errors in 0.008 seconds.
+Tearing down left over layers:
+ Tear down samplelayers.Layer122 in 0.000 seconds.
+ Tear down samplelayers.Layer12 in 0.000 seconds.
+ Tear down samplelayers.Layer1 in 0.000 seconds.
+False
-
The terminal width is determined using the curses module. To see
that, we'll provide a fake curses module:
>>> class FakeCurses:
+ ... class error(Exception):
+ ... pass
... def setupterm(self):
... pass
... def tigetnum(self, ignored):
@@ -227,7 +225,6 @@
##r##
26/26 (100.0%) ... r-ex/sampletests/../sampletestsl.txt##r##
##r##
- <BLANKLINE>
Ran 26 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
Tear down samplelayers.Layer122 in N.NNN seconds.
@@ -235,6 +232,7 @@
Tear down samplelayers.Layer1 in N.NNN seconds.
False
+
>>> sys.modules['curses'] = old_curses
If a second or third level of verbosity are added, we get additional
Modified: zope.testrunner/trunk/src/zope/testrunner/tests.py
===================================================================
--- zope.testrunner/trunk/src/zope/testrunner/tests.py 2010-04-28 15:58:59 UTC (rev 111547)
+++ zope.testrunner/trunk/src/zope/testrunner/tests.py 2010-04-28 15:59:30 UTC (rev 111548)
@@ -46,17 +46,6 @@
(re.compile(r"<type 'exceptions.(\w+)Error'>:"),
r'exceptions.\1Error:'),
- # Remove '\r', since this only causes confusion.
- (re.compile(r'\\r', re.MULTILINE), ''),
- (re.compile(r'\r', re.MULTILINE), ''),
-
- # testtools content formatter is used to mime-encode
- # tracebacks when the SubunitOutputFormatter is used, and the
- # resulting text includes a size which can vary depending on
- # the path included in the traceback.
- (re.compile(r'traceback\n[A-F\d]+', re.MULTILINE),
- r'traceback\nNNN'),
-
(re.compile("'[A-Za-z]:\\\\"), "'"), # hopefully, we'll make Windows happy
# replaces drives with nothing
@@ -72,8 +61,6 @@
(re.compile(r'\d+[.]\d\d\d seconds'), 'N.NNN seconds'),
(re.compile(r'\d+[.]\d\d\d s'), 'N.NNN s'),
(re.compile(r'\d+[.]\d\d\d{'), 'N.NNN{'),
- (re.compile(r'\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d+'),
- 'YYYY-MM-DD HH:MM:SS.mmmmmm'),
(re.compile('( |")[^\n]+testrunner-ex'), r'\1testrunner-ex'),
(re.compile('( |")[^\n]+testrunner.py'), r'\1testrunner.py'),
(re.compile(r'> [^\n]*(doc|unit)test[.]py\(\d+\)'),
@@ -83,12 +70,12 @@
(re.compile(r' line \d+,', re.IGNORECASE), r' Line NNN,'),
(re.compile(r' line {([a-z]+)}\d+{', re.IGNORECASE), r' Line {\1}NNN{'),
- # omit traceback entries for unittest.py or doctest.py (and
- # their package variants) from output:
- (re.compile(r'^ +File "[^\n]*(doctest|unittest|case)(/__init__)?.py", [^\n]+\n[^\n]+\n',
+ # omit traceback entries for unittest.py or doctest.py from
+ # output:
+ (re.compile(r'^ +File "[^\n]*(doc|unit)test.py", [^\n]+\n[^\n]+\n',
re.MULTILINE),
r''),
- (re.compile(r'^{\w+} +File "{\w+}[^\n]*(doctest|unittest|case)(/__init__)?.py{\w+}", [^\n]+\n[^\n]+\n',
+ (re.compile(r'^{\w+} +File "{\w+}[^\n]*(doc|unit)test.py{\w+}", [^\n]+\n[^\n]+\n',
re.MULTILINE),
r''),
#(re.compile('^> [^\n]+->None$', re.M), '> ...->None'),
@@ -116,8 +103,6 @@
(re.compile(r'\d+[.]\d\d\d seconds'), 'N.NNN seconds'),
(re.compile(r'\d+[.]\d\d\d s'), 'N.NNN s'),
(re.compile(r'\d+[.]\d\d\d{'), 'N.NNN{'),
- (re.compile(r'\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d+'),
- 'YYYY-MM-DD HH:MM:SS.mmmmmm'),
(re.compile('( |")[^\n]+testrunner-ex'), r'\1testrunner-ex'),
(re.compile('( |")[^\n]+testrunner.py'), r'\1testrunner.py'),
(re.compile(r'> [^\n]*(doc|unit)test[.]py\(\d+\)'),
@@ -127,19 +112,12 @@
(re.compile(r' line \d+,', re.IGNORECASE), r' Line NNN,'),
(re.compile(r' line {([a-z]+)}\d+{', re.IGNORECASE), r' Line {\1}NNN{'),
- # testtools content formatter is used to mime-encode
- # tracebacks when the SubunitOutputFormatter is used, and the
- # resulting text includes a size which can vary depending on
- # the path included in the traceback.
- (re.compile(r'traceback\n[A-F\d]+', re.MULTILINE),
- r'traceback\nNNN'),
-
- # omit traceback entries for unittest.py or doctest.py (and
- # their package variants) from output:
- (re.compile(r'^ +File "[^\n]*(doctest|unittest|case)(/__init__)?.py", [^\n]+\n[^\n]+\n',
+ # omit traceback entries for unittest.py or doctest.py from
+ # output:
+ (re.compile(r'^ +File "[^\n]*(doc|unit)test.py", [^\n]+\n[^\n]+\n',
re.MULTILINE),
r''),
- (re.compile(r'^{\w+} +File "{\w+}[^\n]*(doctest|unittest|case)(/__init__)?.py{\w+}", [^\n]+\n[^\n]+\n',
+ (re.compile(r'^{\w+} +File "{\w+}[^\n]*(doc|unit)test.py{\w+}", [^\n]+\n[^\n]+\n',
re.MULTILINE),
r''),
(re.compile('import pdb; pdb'), 'Pdb()'), # Py 2.3
@@ -185,7 +163,6 @@
'testrunner-repeat.txt',
'testrunner-gc.txt',
'testrunner-knit.txt',
- 'testrunner-shuffle.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
checker=checker),
@@ -273,29 +250,4 @@
checker=checker,
)
)
-
- try:
- import subunit
- except ImportError:
- suites.append(
- doctest.DocFileSuite(
- 'testrunner-subunit-err.txt',
- setUp=setUp, tearDown=tearDown,
- optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
- checker=checker))
- else:
- suites.append(
- doctest.DocFileSuite(
- 'testrunner-subunit.txt',
- setUp=setUp, tearDown=tearDown,
- optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
- checker=checker))
- if hasattr(sys, 'gettotalrefcount'):
- suites.append(
- doctest.DocFileSuite(
- 'testrunner-subunit-leaks.txt',
- setUp=setUp, tearDown=tearDown,
- optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
- checker=checker))
-
return unittest.TestSuite(suites)
More information about the checkins
mailing list