Revert "bpo-45162: Revert "Remove many old deprecated unittest features"" (GH-92556)

This reverts commit b50322d203.
This commit is contained in:
Serhiy Storchaka 2022-06-26 10:18:06 +03:00 committed by GitHub
parent 38612a05b5
commit c834c02569
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 78 additions and 373 deletions

View file

@ -1262,8 +1262,6 @@ 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)
@ -1271,11 +1269,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), 12)
self.assertEqual(len(out), 10)
# 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 [ae_msg, at_msg, b'rw']:
for msg in [b'rw']:
self.assertEqual(out.count(msg), 1)
args_list = (
@ -1302,11 +1300,9 @@ class Test_TextTestRunner(unittest.TestCase):
with p:
out, err = get_parse_out_err(p)
self.assertIn(b'OK', err)
self.assertEqual(len(out), 14)
self.assertEqual(len(out), 12)
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