Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a4e5e7b
Revert "[3.11] gh-101634: regrtest reports decoding error as failed t…
vstinner Sep 2, 2023
39bf879
Revert "[3.11] bpo-46523: fix tests rerun when `setUp[Class|Module]` …
vstinner Sep 2, 2023
9a03f9c
Revert "gh-95027: Fix regrtest stdout encoding on Windows (GH-98492)"
vstinner Sep 2, 2023
57c050e
Revert "[3.11] gh-94026: Buffer regrtest worker stdout in temporary f…
vstinner Sep 2, 2023
f8e8df3
Revert "Run Tools/scripts/reindent.py (GH-94225)"
vstinner Sep 2, 2023
b95c315
Revert "gh-94052: Don't re-run failed tests with --python option (GH-…
vstinner Sep 2, 2023
9689029
Revert "[3.11] gh-84461: Fix Emscripten umask and permission issues (…
vstinner Sep 2, 2023
9583edd
gh-93353: regrtest checks for leaked temporary files (#93776)
vstinner Jun 14, 2022
7f3f0b3
gh-93353: Fix regrtest for -jN with N >= 2 (GH-93813)
vstinner Jun 14, 2022
9007571
gh-93353: regrtest supports checking tmp files with -j2 (#93909)
vstinner Jun 16, 2022
cb9c17d
gh-84461: Fix Emscripten umask and permission issues (GH-94002)
tiran Jun 19, 2022
70d8b30
gh-94052: Don't re-run failed tests with --python option (#94054)
tiran Jun 21, 2022
5c87ac3
Run Tools/scripts/reindent.py (#94225)
vstinner Jun 26, 2022
24d94ca
gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253)
tiran Jun 29, 2022
693a035
gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96…
zware Sep 8, 2022
73334eb
gh-95027: Fix regrtest stdout encoding on Windows (#98492)
vstinner Oct 21, 2022
2cc75b6
gh-98903: Test suite fails with exit code 4 if no tests ran (#98904)
vstinner Nov 2, 2022
c5bfed5
gh-100086: Add build info to test.libregrtest (#100093)
vstinner Dec 8, 2022
14ef8cf
bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895)
sobolevn Apr 7, 2023
ec875d5
gh-82054: allow test runner to split test_asyncio to execute in paral…
zitterbewegung Apr 30, 2023
5d764de
Display the sanitizer config in the regrtest header. (#105301)
gpshead Jun 6, 2023
f848b2b
gh-101634: regrtest reports decoding error as failed test (#106169)
vstinner Jun 28, 2023
15425da
gh-108223: test.pythoninfo and libregrtest log Py_NOGIL (#108238)
vstinner Aug 21, 2023
deb932f
gh-90791: test.pythoninfo logs ASAN_OPTIONS env var (#108289)
vstinner Aug 22, 2023
30120ff
gh-108388: regrtest splits test_asyncio package (#108393)
vstinner Aug 24, 2023
b882af4
regrtest computes statistics (#108793)
vstinner Sep 2, 2023
b8104bf
gh-108822: Add Changelog entry for regrtest statistics (#108821)
vstinner Sep 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gh-93353: regrtest supports checking tmp files with -j2 (#93909)
regrtest now also implements checking for leaked temporary files and
directories when using -jN for N >= 2. Use tempfile.mkdtemp() to
create the temporary directory. Skip this check on WASI.

(cherry picked from commit 4f85cec)
  • Loading branch information
vstinner committed Sep 2, 2023
commit 9007571dff3e289de907d30187db2cb5d9355a52
9 changes: 6 additions & 3 deletions Lib/test/libregrtest/runtest_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import signal
import subprocess
import sys
import tempfile
import threading
import time
import traceback
Expand Down Expand Up @@ -273,14 +274,16 @@ def _run_process(self, test_name: str, tmp_dir: str) -> tuple[int, str, str]:
self.current_test_name = None

def _runtest(self, test_name: str) -> MultiprocessResult:
if self.ns.use_mp == 1:
# Don't check for leaked temporary files and directories if Python is
# run on WASI. WASI don't pass environment variables like TMPDIR to
# worker processes.
if not support.is_wasi:
# gh-93353: Check for leaked temporary files in the parent process,
# since the deletion of temporary files can happen late during
# Python finalization: too late for libregrtest.
tmp_dir = os.getcwd() + '_tmpdir'
tmp_dir = tempfile.mkdtemp(prefix="test_python_")
tmp_dir = os.path.abspath(tmp_dir)
try:
os.mkdir(tmp_dir)
retcode, stdout = self._run_process(test_name, tmp_dir)
finally:
tmp_files = os.listdir(tmp_dir)
Expand Down
20 changes: 12 additions & 8 deletions Lib/test/test_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,8 @@ def test_cleanup(self):
for name in names:
self.assertFalse(os.path.exists(name), name)

@unittest.skipIf(support.is_wasi,
'checking temp files is not implemented on WASI')
def test_leak_tmp_file(self):
code = textwrap.dedent(r"""
import os.path
Expand All @@ -1371,15 +1373,17 @@ def test_leak_tmp_file(self):
with open(filename, "wb") as fp:
fp.write(b'content')
""")
testname = self.create_test(code=code)
testnames = [self.create_test(code=code) for _ in range(3)]

output = self.run_tests("--fail-env-changed", "-v", "-j1", testname, exitcode=3)
self.check_executed_tests(output, [testname],
env_changed=[testname],
fail_env_changed=True)
self.assertIn(f"Warning -- {testname} leaked temporary "
f"files (1): mytmpfile",
output)
output = self.run_tests("--fail-env-changed", "-v", "-j2", *testnames, exitcode=3)
self.check_executed_tests(output, testnames,
env_changed=testnames,
fail_env_changed=True,
randomize=True)
for testname in testnames:
self.assertIn(f"Warning -- {testname} leaked temporary "
f"files (1): mytmpfile",
output)


class TestUtils(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
regrtest now checks if a test leaks temporary files or directories if run
with -jN option. Patch by Victor Stinner.