-
- Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
test_modulefinder
creates a temporary directory in its global module scope
cpython/Lib/test/test_modulefinder.py
Lines 13 to 14 in 22df2e0
TEST_DIR = tempfile.mkdtemp() | |
TEST_PATH = [TEST_DIR, os.path.dirname(tempfile.__file__)] |
and removes the temporary directory in each test method
cpython/Lib/test/test_modulefinder.py
Lines 349 to 350 in 22df2e0
finally: | |
shutil.rmtree(TEST_DIR) |
If the test is executed in an environment without test worker processes (e.g. WASI) then the test runner complains about changes to the execution environment:
/python-wasm/cpython/builddir/wasi# wasmtime run --mapdir .::../../ -- python.wasm -m test --fail-env-changed test_modulefinder 0:00:00 Run tests sequentially 0:00:00 [1/1] test_modulefinder Warning -- files was modified by test_modulefinder Warning -- Before: ['tmp8avdrxn0/'] Warning -- After: [] test_modulefinder failed (env changed) == Tests result: ENV CHANGED == 1 test altered the execution environment: test_modulefinder Total duration: 292 ms Tests result: ENV CHANGED
test_modulefinder
should create the temporary directory in setUp and rmtree it in tearDown methods instead.
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error