Skip to content

v0.5.0 — Respect pytest's python_files config for test exclusion

Choose a tag to compare

@markng markng released this 08 Apr 18:04
· 20 commits to main since this release
Immutable release. Only release title and notes can be modified.

What's Changed

Bug Fix: Test file exclusion now respects python_files config

Previously, pytest-leela used hardcoded patterns (test_*.py, *_test.py) to exclude test files from mutation targets. This broke projects that use custom test file naming conventions, such as describe_*.py (common with pytest-describe).

Changes in this release:

  • Test file exclusion now reads python_files from pytest.ini / pyproject.toml / setup.cfg instead of relying on hardcoded patterns
  • Custom test file patterns (e.g., describe_*.py) are now correctly excluded from mutation targets when using --diff mode
  • conftest.py is always excluded from mutation targets, regardless of configuration
  • Pattern matching uses fnmatch for consistency with pytest's own behavior

Affected users: Anyone using --diff mode with a non-default python_files setting in their pytest config. Previously, files matching custom patterns would be included as mutation targets, which would generate false negatives (mutations in test infrastructure that don't kill any mutants).

No changes are required to your pytest config or test suite — pytest-leela now reads your existing config automatically.

Commits

  • e730bab Fix --diff mode: exclude test files from mutation targets
  • 36a6f68 Refactor test-file exclusion to use python_files config via fnmatch patterns
  • 0c84183 Fix perfection game feedback: remove dead assertion, nest test block