Skip to content

py.test "--override-ini=python_files=*_tests.py" does not work #2238

Closed
@sirex

Description

@sirex

You can use this sandbox to reproduce the error: https://gist.github.com/sirex/1bf7dda1cc3ba14ce7ebb6f964bf0d39

Sandbox contains module_tests.py, but if I run following command this test is not discovered:

> py.test -o "python_files=*_tests.py"
==================================================================== test session starts =====================================================================
platform linux2 -- Python 2.7.12, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /tmp/pytest/pytest, inifile: 
collected 0 items 

After some debugging I found, that initially --override-ini options are ignored and python_files are cached with default values, then ofter some time --override-ini becomes available, but python_files already have cached values and ignores --override-ini.

But if I add pytest.ini:

> cat pytest.ini 
[pytest]
python_files=*_tests.py

Then this test file is collected.

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