pytest-dev / pytest-dev/pytest
`--pyargs` broken in Python 3.14.2 in tox
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
This issue only presents when using pytest in tox, for some reason, and only when tox tests Python 3.14.2.
I have a project laid out like this:
pytesttest
├── amodule
│ ├── __init__.py
│ └── tests
│ ├── __init__.py
│ └── test_some.py
└── tox.ini
When I run tox run, I get:
============================= test session starts ==============================
platform linux -- Python 3.14.2, pytest-9.0.2, pluggy-1.6.0
cachedir: .tox/py314/.pytest_cache
rootdir: /home/sanotehu/src/pytesttest
collected 0 items
============================ no tests ran in 0.00s =============================
ERROR: module or package not found: amodule.tests (missing __init__.py?)
py314: exit 4 (0.33 seconds) /home/sanotehu/src/pytesttest> pytest --pyargs amodule.tests pid=951849
py314: FAIL code 4 (3.70=setup[3.37]+cmd[0.33] seconds)
evaluation failed :( (3.72 seconds)
But if I go to some other Python 3.14.2 virtualenv and run pytest --pyargs amodule.tests, the test passes. Usually. I might have to run pyclean --debris=all first.
Contents of test_some.py:
def test_something():
print("Hello, world!")
Contents of tox.ini:
[tox]
envlist = py314
[testenv]
deps = pytest
commands = pytest --pyargs amodule.tests
Output of pip list:
Package Version
------------- -------
cachetools 6.2.4
chardet 5.2.0
colorama 0.4.6
distlib 0.4.0
filelock 3.20.1
packaging 25.0
pip 24.0
platformdirs 4.5.1
pluggy 1.6.0
pyproject-api 1.10.0
tox 4.32.0
virtualenv 20.35.4
I filed the same issue in tox, since I can't tell which is responsible.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the pytest --pyargs amodule.tests command from the reported tox.ini on Python 3.14.2, comparing the tox environment with the standalone virtualenv. Inspect how --pyargs resolves amodule.tests and use test_some.py as the success case. Done means the tox invocation collects and runs the test reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100