diff options
| author | Gregory P. Smith <greg@krypto.org> | 2022-01-26 20:39:15 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-26 20:39:15 -0800 |
| commit | b50322d20337ca468f2070eedb051a16ee1eba94 (patch) | |
| tree | ba478b8fe2b91b583cec640d518f9643fb5b6f7d /Lib/unittest/test/test_runner.py | |
| parent | 9f0881476e0113d3a35e0ffa96649b9276dd75c5 (diff) | |
| download | cpython-git-b50322d20337ca468f2070eedb051a16ee1eba94.tar.gz | |
bpo-45162: Revert "Remove many old deprecated unittest features" (GH-30935)
Revert "bpo-45162: Remove many old deprecated unittest features (GH-28268)"
This reverts commit b0a6ede3d0bd6fa4ffe413ab4dfc1059201df25b.
We're deferring this change until 3.12 while upstream projects that use
the legacy assertion method names are fixed. See the issue for links
to the discussion. Many upstream projects now have issues and PRs
filed.
Diffstat (limited to 'Lib/unittest/test/test_runner.py')
| -rw-r--r-- | Lib/unittest/test/test_runner.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py index bcf7538c26..c487e9ec4e 100644 --- a/Lib/unittest/test/test_runner.py +++ b/Lib/unittest/test/test_runner.py @@ -1150,6 +1150,8 @@ class Test_TextTestRunner(unittest.TestCase): return [b.splitlines() for b in p.communicate()] opts = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=os.path.dirname(__file__)) + ae_msg = b'Please use assertEqual instead.' + at_msg = b'Please use assertTrue instead.' # no args -> all the warnings are printed, unittest warnings only once p = subprocess.Popen([sys.executable, '-E', '_test_warnings.py'], **opts) @@ -1157,11 +1159,11 @@ class Test_TextTestRunner(unittest.TestCase): out, err = get_parse_out_err(p) self.assertIn(b'OK', err) # check that the total number of warnings in the output is correct - self.assertEqual(len(out), 10) + self.assertEqual(len(out), 12) # check that the numbers of the different kind of warnings is correct for msg in [b'dw', b'iw', b'uw']: self.assertEqual(out.count(msg), 3) - for msg in [b'rw']: + for msg in [ae_msg, at_msg, b'rw']: self.assertEqual(out.count(msg), 1) args_list = ( @@ -1188,9 +1190,11 @@ class Test_TextTestRunner(unittest.TestCase): with p: out, err = get_parse_out_err(p) self.assertIn(b'OK', err) - self.assertEqual(len(out), 12) + self.assertEqual(len(out), 14) for msg in [b'dw', b'iw', b'uw', b'rw']: self.assertEqual(out.count(msg), 3) + for msg in [ae_msg, at_msg]: + self.assertEqual(out.count(msg), 1) def testStdErrLookedUpAtInstantiationTime(self): # see issue 10786 |
