Skip to content

--pyargs broken in Python 3.14.2 in tox #14048

@clayote

Description

@clayote

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions