Skip to content

Commit

Permalink
heh, now it's consistent the way it started, so revert the test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Nov 5, 2014
1 parent 63fae4b commit 1ca8518
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 101 deletions.
2 changes: 1 addition & 1 deletion src/zope/testrunner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ def layer_sortkey(layer):
return tuple((c.__module__, c.__name__) for c in getmro(layer)[::-1] if c is not object)

layers = [layer for layer in layers]
layers.sort(key=layer_sortkey, reverse=True)
layers.sort(key=layer_sortkey)
gathered = []
for layer in layers:
gather_layers(layer, gathered)
Expand Down
62 changes: 31 additions & 31 deletions src/zope/testrunner/tests/testrunner-colors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,37 @@ A failed test run highlights the failures in red:

>>> sys.argv = 'test -c --tests-pattern ^sampletests(f|_e|_f)?$ '.split()
>>> testrunner.run_internal(defaults)
{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, {green}0{normal} errors, {green}0{normal} skipped in {green}0.001{normal} seconds.{normal}
{normal}Running samplelayers.Layer11 tests:{normal}
Set up samplelayers.Layer11 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {green}0{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.007{normal} seconds.{normal}
{normal}Running samplelayers.Layer111 tests:{normal}
Set up samplelayers.Layerx in {green}0.000{normal} seconds.
Set up samplelayers.Layer111 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {green}0{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.008{normal} seconds.{normal}
{normal}Running samplelayers.Layer112 tests:{normal}
Tear down samplelayers.Layer111 in {green}0.000{normal} seconds.
Set up samplelayers.Layer112 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {green}0{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.008{normal} seconds.{normal}
{normal}Running samplelayers.Layer12 tests:{normal}
Tear down samplelayers.Layer112 in {green}0.000{normal} seconds.
Tear down samplelayers.Layerx in {green}0.000{normal} seconds.
Tear down samplelayers.Layer11 in {green}0.000{normal} seconds.
Set up samplelayers.Layer12 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {green}0{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.007{normal} seconds.{normal}
{normal}Running samplelayers.Layer121 tests:{normal}
Set up samplelayers.Layer121 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {green}0{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.007{normal} seconds.{normal}
{normal}Running samplelayers.Layer122 tests:{normal}
Tear down samplelayers.Layer121 in {green}0.000{normal} seconds.
Set up samplelayers.Layer122 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {green}0{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.008{normal} seconds.{normal}
{normal}Running zope.testrunner.layer.UnitTests tests:{normal}
Tear down samplelayers.Layer122 in {green}0.000{normal} seconds.
Tear down samplelayers.Layer12 in {green}0.000{normal} seconds.
Tear down samplelayers.Layer1 in {green}0.000{normal} seconds.
Set up zope.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
<BLANKLINE>
<BLANKLINE>
Expand Down Expand Up @@ -145,38 +175,8 @@ A failed test run highlights the failures in red:
{red}AssertionError: 1 != 0{normal}
<BLANKLINE>
{normal} Ran {green}164{normal} tests with {boldred}3{normal} failures, {boldred}1{normal} errors, {green}0{normal} skipped in {green}0.045{normal} seconds.{normal}
{normal}Running samplelayers.Layer1 tests:{normal}
Tear down zope.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
Set up samplelayers.Layer1 in {green}0.000{normal} seconds.
{normal} Ran {green}9{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.001{normal} seconds.{normal}
{normal}Running samplelayers.Layer11 tests:{normal}
Set up samplelayers.Layer11 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.007{normal} seconds.{normal}
{normal}Running samplelayers.Layer111 tests:{normal}
Set up samplelayers.Layerx in {green}0.000{normal} seconds.
Set up samplelayers.Layer111 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.008{normal} seconds.{normal}
{normal}Running samplelayers.Layer112 tests:{normal}
Tear down samplelayers.Layer111 in {green}0.000{normal} seconds.
Set up samplelayers.Layer112 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.008{normal} seconds.{normal}
{normal}Running samplelayers.Layer12 tests:{normal}
Tear down samplelayers.Layer112 in {green}0.000{normal} seconds.
Tear down samplelayers.Layerx in {green}0.000{normal} seconds.
Tear down samplelayers.Layer11 in {green}0.000{normal} seconds.
Set up samplelayers.Layer12 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.007{normal} seconds.{normal}
{normal}Running samplelayers.Layer121 tests:{normal}
Set up samplelayers.Layer121 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.007{normal} seconds.{normal}
{normal}Running samplelayers.Layer122 tests:{normal}
Tear down samplelayers.Layer121 in {green}0.000{normal} seconds.
Set up samplelayers.Layer122 in {green}0.000{normal} seconds.
{normal} Ran {green}26{normal} tests with {boldred}3{normal} failures, {green}0{normal} errors, {green}0{normal} skipped in {green}0.008{normal} seconds.{normal}
{normal}Tearing down left over layers:{normal}
Tear down samplelayers.Layer122 in {green}0.000{normal} seconds.
Tear down samplelayers.Layer12 in {green}0.000{normal} seconds.
Tear down samplelayers.Layer1 in {green}0.000{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, {green}0{normal} skipped in {green}0.023{normal} seconds.{normal}
True

Expand Down
10 changes: 5 additions & 5 deletions src/zope/testrunner/tests/testrunner-coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ directory name given as the parameter will be used to hold the reports.

>>> from zope import testrunner
>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in 0.687 seconds.
Running samplelayers.Layer1 tests:
Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
Set up samplelayers.Layer1 in 0.000 seconds.
Ran 9 tests with 0 failures, 0 errors and 0 skipped in 0.000 seconds.
Running samplelayers.Layer11 tests:
Expand All @@ -50,10 +46,14 @@ directory name given as the parameter will be used to hold the reports.
Tear down samplelayers.Layer121 in 0.000 seconds.
Set up samplelayers.Layer122 in 0.000 seconds.
Ran 26 tests with 0 failures, 0 errors and 0 skipped in 0.125 seconds.
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Tear down samplelayers.Layer122 in 0.000 seconds.
Tear down samplelayers.Layer12 in 0.000 seconds.
Tear down samplelayers.Layer1 in 0.000 seconds.
Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in 0.687 seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
lines cov% module (path)
...
48 100% sampletests.test1 (testrunner-ex/sampletests/test1.py)
Expand Down
12 changes: 8 additions & 4 deletions src/zope/testrunner/tests/testrunner-edge-cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ affecting the Python path:
>>> sys.argv = ['test']
>>> testrunner.run_internal(defaults)
... # doctest: +ELLIPSIS
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Running samplelayers.Layer1 tests:
Set up samplelayers.Layer1 in 0.000 seconds.
Ran 9 tests with 0 failures, 0 errors and 0 skipped in 0.000 seconds.
...
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Tear down samplelayers.Layer122 in N.NNN seconds.
Tear down samplelayers.Layer12 in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Total: 321 tests, 0 failures, 0 errors and 0 skipped in N.NNN seconds.
False

Expand Down
17 changes: 10 additions & 7 deletions src/zope/testrunner/tests/testrunner-errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ be read only):
>>> sys.argv = 'test --tests-pattern ^sampletests(f|_e|_f)?$ '.split()
>>> testrunner.run_internal(defaults)
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
Running samplelayers.Layer1 tests:
...
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
...
<BLANKLINE>
<BLANKLINE>
Failure in test eek (sample2.sampletests_e)
Expand Down Expand Up @@ -95,11 +97,8 @@ be read only):
AssertionError: 1 != 0
<BLANKLINE>
Ran 164 tests with 3 failures, 1 errors and 0 skipped 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.
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Total: 329 tests, 3 failures, 1 errors and 0 skipped in N.NNN seconds.
True

Expand Down Expand Up @@ -836,12 +835,16 @@ Passing tests exit with code 0 according to UNIX practices:
... else:
... print('sys.exit was not called')
... # doctest: +ELLIPSIS
Running zope.testrunner.layer.UnitTests tests:
Running samplelayers.Layer11 tests:
...
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Tear down samplelayers.Layer122 in N.NNN seconds.
Tear down samplelayers.Layer12 in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 130 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Total: 286 tests, 0 failures, 0 errors and 0 skipped in N.NNN seconds.
exited with code 0

Expand Down
32 changes: 16 additions & 16 deletions src/zope/testrunner/tests/testrunner-layers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ We can select which layers to run using the --layer option:
>>> sys.argv = 'test --layer 112 --layer Unit'.split()
>>> from zope import testrunner
>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Running samplelayers.Layer112 tests:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Set up samplelayers.Layerx in N.NNN seconds.
Set up samplelayers.Layer1 in N.NNN seconds.
Set up samplelayers.Layer11 in N.NNN seconds.
Set up samplelayers.Layer112 in N.NNN seconds.
Ran 26 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Tear down samplelayers.Layer112 in N.NNN seconds.
Tear down samplelayers.Layerx in N.NNN seconds.
Tear down samplelayers.Layer11 in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Total: 182 tests, 0 failures, 0 errors and 0 skipped in N.NNN seconds.
False

Expand Down Expand Up @@ -86,11 +86,7 @@ Or we can explicitly say that we want both unit and non-unit tests.

>>> sys.argv = 'test -uf'.split()
>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Running samplelayers.Layer1 tests:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Set up samplelayers.Layer1 in N.NNN seconds.
Ran 9 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Running samplelayers.Layer11 tests:
Expand All @@ -117,25 +113,24 @@ Or we can explicitly say that we want both unit and non-unit tests.
Tear down samplelayers.Layer121 in N.NNN seconds.
Set up samplelayers.Layer122 in N.NNN seconds.
Ran 26 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Tear down samplelayers.Layer122 in N.NNN seconds.
Tear down samplelayers.Layer12 in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Total: 321 tests, 0 failures, 0 errors and 0 skipped in N.NNN seconds.
False

It is possible to force the layers to run in subprocesses and parallelize them.

>>> sys.argv = [testrunner_script, '-j2']
>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Running samplelayers.Layer1 tests:
Running in a subprocess.
Set up samplelayers.Layer1 in N.NNN seconds.
Ran 9 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Running samplelayers.Layer11 tests:
Running in a subprocess.
Set up samplelayers.Layer1 in N.NNN seconds.
Expand Down Expand Up @@ -190,7 +185,12 @@ It is possible to force the layers to run in subprocesses and parallelize them.
Tear down samplelayers.Layer122 in N.NNN seconds.
Tear down samplelayers.Layer12 in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Running in a subprocess.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Tearing down left over layers:
Tear down samplelayers.Layer1 in N.NNN seconds.
Total: 321 tests, 0 failures, 0 errors and 0 skipped in N.NNN seconds.
False
4 changes: 2 additions & 2 deletions src/zope/testrunner/tests/testrunner-profiling.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ When the tests are run, we get profiling output.

>>> from zope import testrunner
>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
...
Running samplelayers.Layer1 tests:
...
Running samplelayers.Layer11 tests:
...
Running zope.testrunner.layer.UnitTests tests:
...
ncalls tottime percall cumtime percall filename:lineno(function)
...
Expand Down
26 changes: 13 additions & 13 deletions src/zope/testrunner/tests/testrunner-repeat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ themselves.
>>> sys.argv = 'test --layer 112 --layer UnitTests --repeat 3'.split()
>>> from zope import testrunner
>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Iteration 1
Ran 156 tests with 0 failures, 0 errors and 0 skipped in 0.010 seconds.
Iteration 2
Ran 156 tests with 0 failures, 0 errors and 0 skipped in 0.010 seconds.
Iteration 3
Ran 156 tests with 0 failures, 0 errors and 0 skipped in 0.010 seconds.
Running samplelayers.Layer112 tests:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Set up samplelayers.Layerx in 0.000 seconds.
Set up samplelayers.Layer1 in 0.000 seconds.
Set up samplelayers.Layer11 in 0.000 seconds.
Set up samplelayers.Layer112 in 0.000 seconds.
Iteration 1
Ran 26 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Ran 26 tests with 0 failures, 0 errors and 0 skipped in 0.010 seconds.
Iteration 2
Ran 26 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Ran 26 tests with 0 failures, 0 errors and 0 skipped in 0.010 seconds.
Iteration 3
Ran 26 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Ran 26 tests with 0 failures, 0 errors and 0 skipped in 0.010 seconds.
Running zope.testrunner.layer.UnitTests tests:
Tear down samplelayers.Layer112 in N.NNN seconds.
Tear down samplelayers.Layerx in N.NNN seconds.
Tear down samplelayers.Layer11 in N.NNN seconds.
Tear down samplelayers.Layer1 in N.NNN seconds.
Set up zope.testrunner.layer.UnitTests in N.NNN seconds.
Iteration 1
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Iteration 2
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Iteration 3
Ran 156 tests with 0 failures, 0 errors and 0 skipped in N.NNN seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in N.NNN seconds.
Total: 182 tests, 0 failures, 0 errors and 0 skipped in N.NNN seconds.
False

Expand Down
10 changes: 5 additions & 5 deletions src/zope/testrunner/tests/testrunner-report-skipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ If tests has been skipped in a layer, they are reported in the layer's status
line, and in the total status line::

>>> testrunner.run_internal(defaults)
Running zope.testrunner.layer.UnitTests tests:
Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
Ran 1 tests with 0 failures, 0 errors and 1 skipped in 0.000 seconds.
Running sample_skipped_tests.Layer tests:
Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
Set up sample_skipped_tests.Layer in 0.000 seconds.
Ran 2 tests with 0 failures, 0 errors and 1 skipped in 0.000 seconds.
Tearing down left over layers:
Running zope.testrunner.layer.UnitTests tests:
Tear down sample_skipped_tests.Layer in 0.000 seconds.
Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
Ran 1 tests with 0 failures, 0 errors and 1 skipped in 0.000 seconds.
Tearing down left over layers:
Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
Total: 3 tests, 0 failures, 0 errors and 2 skipped in 0.034 seconds.
False

Expand Down
Loading

0 comments on commit 1ca8518

Please sign in to comment.