Skip to content

testing/test_collection.py::test_collect_short_file_windows freezes #13770

@macdjord

Description

@macdjord

The test testing/test_collection.py::test_collect_short_file_windows from PyTest's own test suite freezes:

(env) C:\Users\jordan.macdonald\source\macdjord\pytest.git>
(env) C:\Users\jordan.macdonald\source\macdjord\pytest.git>tox -e linting,py -- -v
linting: commands[0]> pre-commit run --all-files --show-diff-on-failure -v
ruff check......................................................................Passed
- hook id: ruff-check
- duration: 0.09s

All checks passed!

ruff format.....................................................................Passed
- hook id: ruff-format
- duration: 0.08s

268 files left unchanged

trim trailing whitespace........................................................Passed
- hook id: trailing-whitespace
- duration: 0.47s
fix end of files................................................................Passed
- hook id: end-of-file-fixer
- duration: 0.78s
check yaml......................................................................Passed
- hook id: check-yaml
- duration: 0.33s
zizmor..........................................................................Passed
- hook id: zizmor
- duration: 0.42s

INFO zizmor::registry: skipping impostor-commit: can't run without a GitHub API token
 INFO zizmor::registry: skipping ref-confusion: can't run without a GitHub API token
 INFO zizmor::registry: skipping known-vulnerable-actions: can't run without a GitHub API token
 INFO zizmor::registry: skipping stale-action-refs: can't run without a GitHub API token
 INFO zizmor::registry: skipping ref-version-mismatch: can't run without a GitHub API token
 INFO audit: zizmor: 🌈 completed .github/workflows/deploy.yml
 INFO audit: zizmor: 🌈 completed .github/workflows/doc-check-links.yml
 INFO audit: zizmor: 🌈 completed .github/workflows/prepare-release-pr.yml
 INFO audit: zizmor: 🌈 completed .github/workflows/stale.yml
 INFO audit: zizmor: 🌈 completed .github/workflows/test.yml
 INFO audit: zizmor: 🌈 completed .github/workflows/update-plugin-list.yml
No findings to report. Good job! (23 suppressed)

blacken-docs....................................................................Passed
- hook id: blacken-docs
- duration: 4.23s
codespell.......................................................................Passed
- hook id: codespell
- duration: 1.34s
type annotations not comments...................................................Passed
- hook id: python-use-type-annotations
- duration: 0.38s
mypy............................................................................Passed
- hook id: mypy
- duration: 1.0s

Success: no issues found in 237 source files

pyproject-fmt...................................................................Passed
- hook id: pyproject-fmt
- duration: 0.31s

no change for pyproject.toml

rst.............................................................................Passed
- hook id: rst
- duration: 0.55s
changelog filenames.........................................(no files to check)Skipped
- hook id: changelogs-rst
Changelog files should use a non-broken :user:`name` role.......................Passed
- hook id: changelogs-user-role
- duration: 0.33s
py library is deprecated........................................................Passed
- hook id: py-deprecated
- duration: 0.42s
py.path usage is deprecated.....................................................Passed
- hook id: py-path-deprecated
- duration: 0.45s
linting: OK ✔ in 13.92 seconds
.pkg: _optional_hooks> python C:\Users\jordan.macdonald\source\macdjord\pytest.git\env\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python C:\Users\jordan.macdonald\source\macdjord\pytest.git\env\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_editable> python C:\Users\jordan.macdonald\source\macdjord\pytest.git\env\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
.pkg: build_sdist> python C:\Users\jordan.macdonald\source\macdjord\pytest.git\env\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
py: install_package> python -I -m pip install --force-reinstall --no-deps C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\.tmp\package\6\pytest-8.5.0.dev141+g184f5f1df.tar.gz
py: commands[0]> pytest -v
=========================================================================================================== test session starts ============================================================================================================
platform win32 -- Python 3.11.2, pytest-8.5.0.dev141+g184f5f1df, pluggy-1.6.0 -- C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Scripts\python.EXE
cachedir: .tox\py\.pytest_cache
hypothesis profile 'default'
rootdir: C:\Users\jordan.macdonald\source\macdjord\pytest.git
configfile: pyproject.toml
testpaths: testing
plugins: hypothesis-6.140.2
collecting ... collected 3932 items

testing/_py/test_local.py::TestLocalPath::test_constructor_equality PASSED [  0%]
testing/_py/test_local.py::TestLocalPath::test_eq_nonstring PASSED       [  0%]
testing/_py/test_local.py::TestLocalPath::test_new_identical PASSED      [  0%]
testing/_py/test_local.py::TestLocalPath::test_join PASSED               [  0%]
[...]
testing/test_collection.py::TestImportModeImportlib::test_modules_importable_as_side_effect PASSED [ 60%]
testing/test_collection.py::TestImportModeImportlib::test_modules_not_importable_as_side_effect PASSED [ 60%]
testing/test_collection.py::TestImportModeImportlib::test_using_python_path PASSED [ 60%]
testing/test_collection.py::test_does_not_crash_on_error_from_decorated_function PASSED [ 60%]
testing/test_collection.py::test_does_not_crash_on_recursive_symlink SKIPPED [ 60%]
testing/test_collection.py::test_collect_short_file_windows

At that point, it freezes up. After 20+ minutes, I killed it with Ctrl-C:

testing/test_collection.py::test_collect_short_file_windows

================================================================================================================= XPASSES ==================================================================================================================
__________________________________________________________________________________________ TestLocalPath.test_make_numbered_dir_multiprocess_safe __________________________________________________________________________________________
----------------------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------------------
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
C:\Users\jordan.macdonald\source\macdjord\pytest.git\.tox\py\Lib\site-packages\_pytest\_py\path.py:1308: EncodingWarning: 'encoding' argument not specified
  with os.fdopen(fd, "w") as f:
========================================================================================================= short test summary info ==========================================================================================================
XPASS testing/_py/test_local.py::TestLocalPath::test_make_numbered_dir_multiprocess_safe - #11603
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<frozen ntpath>:185: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
=================================================================================== 2274 passed, 105 skipped, 6 xfailed, 1 xpassed in 1334.05s (0:22:14) ===================================================================================
py: exit 2 (1336.47 seconds) C:\Users\jordan.macdonald\source\macdjord\pytest.git> pytest -v pid=15224
ROOT: [8208] KeyboardInterrupt - teardown started
  linting: OK (13.92=setup[0.08]+cmd[13.84] seconds)
  py: FAIL code 2 (1357.67=setup[21.20]+cmd[1336.47] seconds)
  evaluation failed :( (1372.27 seconds)

(env) C:\Users\jordan.macdonald\source\macdjord\pytest.git>

Running again with --full-trace produced a traceback which is too long to include here, so I've uploaded it seperately.

Notes

This appears to be related to a known issue in Python: python/cpython#66305

Versions

OS: Windows 10

jordan.macdonald@VOTMTL01L028 MINGW64 ~/source/macdjord/pytest.git (main)
$ pip list
Package       Version
------------- -------
cachetools    6.2.0
cfgv          3.4.0
chardet       5.2.0
colorama      0.4.6
distlib       0.4.0
filelock      3.19.1
identify      2.6.14
nodeenv       1.9.1
packaging     25.0
pip           25.2
platformdirs  4.4.0
pluggy        1.6.0
pre_commit    4.3.0
pyproject-api 1.9.1
PyYAML        6.0.3
setuptools    80.3.1
tox           4.30.2
virtualenv    20.34.0
(env) 
jordan.macdonald@VOTMTL01L028 MINGW64 ~/source/macdjord/pytest.git (main)
$ git log -1
commit 184f5f1dfe3b8c987304b05bbacc2da86d8ad7d3 (HEAD -> main, origin/main, origin/HEAD, add_ci_opts)
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Mon Sep 29 21:18:25 2025 +0000

    [pre-commit.ci] pre-commit autoupdate (#13765)
    
    updates:
    - [github.com/astral-sh/ruff-pre-commit: v0.13.1 → v0.13.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.1...v0.13.2)
    - [github.com/woodruffw/zizmor-pre-commit: v1.13.0 → v1.14.2](https://github.com/woodruffw/zizmor-pre-commit/compare/v1.13.0...v1.14.2)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(env) 
jordan.macdonald@VOTMTL01L028 MINGW64 ~/source/macdjord/pytest.git (main)
$ which python 
/c/Users/jordan.macdonald/source/macdjord/pytest.git/env/Scripts/python
(env) 
jordan.macdonald@VOTMTL01L028 MINGW64 ~/source/macdjord/pytest.git (main)
$ python --version
Python 3.11.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: windowswindows platform-specific problemtype: selftestsa problem in the tests of pytest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions