summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-09 22:51:24 (GMT)
committerGitHub <noreply@github.com>2023-09-09 22:51:24 (GMT)
commit24fa8f2046965b46c70a750a5a004708a63ac770 (patch)
treefc09e33076782715647e83d26f5e1d8cc0a16f87 /Lib/test/test_regrtest.py
parentd3ed9921cdd8ac291fbfe3adf42f7730d3a14dbc (diff)
downloadcpython-24fa8f2046965b46c70a750a5a004708a63ac770.zip
cpython-24fa8f2046965b46c70a750a5a004708a63ac770.tar.gz
cpython-24fa8f2046965b46c70a750a5a004708a63ac770.tar.bz2
gh-109162: libregrtest: fix _decode_worker_job() (#109202)
Decode also HuntRefleak() object inside the RunTests object. Add an unit test on huntrleaks with multiprocessing (-R -jN).
Diffstat (limited to 'Lib/test/test_regrtest.py')
-rw-r--r--Lib/test/test_regrtest.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 8cced1f..23896fd 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -1018,12 +1018,16 @@ class ArgsTestCase(BaseTestCase):
stats=TestStats(4, 1),
forever=True)
- def check_leak(self, code, what):
+ def check_leak(self, code, what, *, multiprocessing=False):
test = self.create_test('huntrleaks', code=code)
filename = 'reflog.txt'
self.addCleanup(os_helper.unlink, filename)
- output = self.run_tests('--huntrleaks', '6:3:', test,
+ cmd = ['--huntrleaks', '6:3:']
+ if multiprocessing:
+ cmd.append('-j1')
+ cmd.append(test)
+ output = self.run_tests(*cmd,
exitcode=EXITCODE_BAD_TEST,
stderr=subprocess.STDOUT)
self.check_executed_tests(output, [test], failed=test, stats=1)
@@ -1039,7 +1043,7 @@ class ArgsTestCase(BaseTestCase):
self.assertIn(line2, reflog)
@unittest.skipUnless(support.Py_DEBUG, 'need a debug build')
- def test_huntrleaks(self):
+ def check_huntrleaks(self, *, multiprocessing: bool):
# test --huntrleaks
code = textwrap.dedent("""
import unittest
@@ -1050,7 +1054,13 @@ class ArgsTestCase(BaseTestCase):
def test_leak(self):
GLOBAL_LIST.append(object())
""")
- self.check_leak(code, 'references')
+ self.check_leak(code, 'references', multiprocessing=multiprocessing)
+
+ def test_huntrleaks(self):
+ self.check_huntrleaks(multiprocessing=False)
+
+ def test_huntrleaks_mp(self):
+ self.check_huntrleaks(multiprocessing=True)
@unittest.skipUnless(support.Py_DEBUG, 'need a debug build')
def test_huntrleaks_fd_leak(self):