mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-108834: Sync libregrtest with the main branch (#108966)
* gh-108834: regrtest reruns failed tests in subprocesses (#108839) When using --rerun option, regrtest now re-runs failed tests in verbose mode in fresh worker processes to have more deterministic behavior. So it can write its final report even if a test killed a worker progress. Add --fail-rerun option to regrtest: exit with non-zero exit code if a test failed pass passed when re-run in verbose mode (in a fresh process). That's now more useful since tests can pass when re-run in a fresh worker progress, whereas they failed when run after other tests when tests are run sequentially. Rename --verbose2 option (-w) to --rerun. Keep --verbose2 as a deprecated alias. Changes: * Fix and enhance statistics in regrtest summary. Add "(filtered)" when --match and/or --ignore options are used. * Add RunTests class. * Add TestResult.get_rerun_match_tests() method * Rewrite code to serialize/deserialize worker arguments as JSON using a new WorkerJob class. * Fix stats when a test is run with --forever --rerun. * If failed test names cannot be parsed, log a warning and don't filter tests. * test_regrtest.test_rerun_success() now uses a marker file, since the test is re-run in a separated process. * Add tests on normalize_test_name() function. * Add test_success() and test_skip() tests to test_regrtest. (cherry picked from commit31c2945f14
) * gh-108834: regrtest --fail-rerun exits with code 5 (#108896) When the --fail-rerun option is used and a test fails and then pass, regrtest now uses exit code 5 ("rerun) instead of 2 ("bad test"). (cherry picked from commit1170d5a292
) * gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) (cherry picked from commit1e0d62793a
) * Manually sync Lib/test/libregrtest/ from main --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
eeaae92b49
commit
0855b2c8b6
29 changed files with 890 additions and 497 deletions
|
@ -10,7 +10,7 @@ import calendar
|
|||
import threading
|
||||
import socket
|
||||
|
||||
from test.support import verbose, run_with_tz, run_with_locale, cpython_only
|
||||
from test.support import verbose, run_with_tz, run_with_locale, cpython_only, requires_resource
|
||||
from test.support import hashlib_helper
|
||||
from test.support import threading_helper
|
||||
import unittest
|
||||
|
@ -457,6 +457,7 @@ class NewIMAPTestsMixin():
|
|||
with self.imap_class(*server.server_address):
|
||||
pass
|
||||
|
||||
@requires_resource('walltime')
|
||||
def test_imaplib_timeout_test(self):
|
||||
_, server = self._setup(SimpleIMAPHandler)
|
||||
addr = server.server_address[1]
|
||||
|
@ -550,6 +551,7 @@ class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase):
|
|||
imap_class = IMAP4_SSL
|
||||
server_class = SecureTCPServer
|
||||
|
||||
@requires_resource('walltime')
|
||||
def test_ssl_raises(self):
|
||||
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
self.assertEqual(ssl_context.verify_mode, ssl.CERT_REQUIRED)
|
||||
|
@ -564,6 +566,7 @@ class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase):
|
|||
ssl_context=ssl_context)
|
||||
client.shutdown()
|
||||
|
||||
@requires_resource('walltime')
|
||||
def test_ssl_verified(self):
|
||||
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
ssl_context.load_verify_locations(CAFILE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue