This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2021-09-06.16:28:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630945732.21.0.656532683711.issue45118@roundup.psfhosted.org>
In-reply-to
Content
When running Python with test -w/--verbose2 command line option to re-run tests which failed, the failing tests are listed in the first summary, and they are not listed in the final summary.

Example with Lib/test/test_x.py:
---
import builtins
import unittest

class Tests(unittest.TestCase):
    def test_succeed(self):
        return

    def test_fail_once(self):
        if not hasattr(builtins, '_test_failed'):
            builtins._test_failed = True
            self.fail("bug")
---

Current output when running test_sys (success) and test_x (failed once, then pass):
---
$ ./python -m test test_sys test_x -w
0:00:00 load avg: 0.80 Run tests sequentially
0:00:00 load avg: 0.80 [1/2] test_sys
0:00:01 load avg: 0.80 [2/2] test_x
test test_x failed -- Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_x.py", line 11, in test_fail_once
    self.fail("bug")
    ^^^^^^^^^^^^^^^^
AssertionError: bug

test_x failed (1 failure)

== Tests result: FAILURE ==

1 test OK.

1 test failed:
    test_x

1 re-run test:
    test_x
0:00:01 load avg: 0.80
0:00:01 load avg: 0.80 Re-running failed tests in verbose mode
0:00:01 load avg: 0.80 Re-running test_x in verbose mode (matching: test_fail_once)
test_fail_once (test.test_x.Tests) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

== Tests result: FAILURE then SUCCESS ==

All 2 tests OK.

Total duration: 2.0 sec
Tests result: FAILURE then SUCCESS
---

"re-run tests" is missing in the last summary.
History
Date User Action Args
2021-09-06 16:28:52vstinnersetrecipients: + vstinner
2021-09-06 16:28:52vstinnersetmessageid: <1630945732.21.0.656532683711.issue45118@roundup.psfhosted.org>
2021-09-06 16:28:52vstinnerlinkissue45118 messages
2021-09-06 16:28:52vstinnercreate