Skip to content

pytest.ini wins even when it's empty, and .pytest.ini is never read #159

Closed

Description

@adityankale190895

pytest's rule: pytest.ini "will always match and take precedence … even if empty", and it matches even without a [pytest] section. The hidden .pytest.ini works the same way. Only pyproject.toml, tox.ini and setup.cfg need their section to match. The first match wins, and options are never merged.

readPytestSettings skips any file without the section (if (!section) continue;) and never looks at .pytest.ini. So:

  • With a pytest.ini that has only a comment, plus a pyproject.toml that sets python_files = ["check_*.py"], DiffCI uses check_*.py. pytest uses its defaults, test_*.py and *_test.py. DiffCI then doesn't see test_x.py as a test.
  • With only a .pytest.ini that sets python_files = check_*.py, DiffCI uses the defaults and doesn't see check_x.py as a test.

Done when:

  • The search order is pytest.ini, .pytest.ini, then pyproject.toml, tox.ini and setup.cfg.
  • An existing pytest.ini or .pytest.ini stops the search, even without a [pytest] section. pytest's defaults apply when it has no section.
  • .pytest.ini is added to PROJECT_FILES, so a repository whose only pytest file is .pytest.ini is detected as a Python project.
  • There is a test for each of the two cases above.

New to DiffCI? See CONTRIBUTING.md: add a synthetic fixture, run npm test, and sign off commits with git commit -s. Comment here to claim the issue.

Activity

  1. added
    bug
    good first issue
    on Nov 17, 2026
  2. added a commit that references this issue on Nov 18, 2026
    db0166f
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

    adapterbuggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions