Skip to content

Python: plugins loaded with -p in pytest addopts are not in the graph #206

Closed

Description

@FredApps

readPytestSettings (src/repo/adapters/python.ts) reads python_files, testpaths and pythonpath, but not addopts. A first-party plugin that addopts loads with -p is imported by pytest before collection, but nothing in the graph imports it.

pyproject.toml     [tool.pytest.ini_options]
                   addopts = "-p myplugin"
myplugin.py        @pytest.fixture def answer(): return 42
tests/test_a.py    def test_a(answer): assert answer == 42

python -m pytest tests/test_a.py passes and needs myplugin.py.

Expected: a change to myplugin.py selects tests/test_a.py, or falls back.

Actual: fallbackRequired: false, no affected tests, no blocker.

The same applies to pytest.ini, tox.ini and setup.cfg. A triple-quoted addopts = """...""" in pyproject.toml is also read as an empty string by the current regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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