refactor: move pytest-cov to lint dependency group - #75
Open
lemenkov wants to merge 1 commit into
Open
Conversation
lemenkov
force-pushed
the
separate_cov_and_lint
branch
from
December 13, 2025 13:12
1c7f169 to
31ff80f
Compare
Currently, pytest-cov runs automatically on every pytest invocation due to the coverage flags in [tool.pytest.ini_options] addopts. This creates several issues for packagers and downstream users: 1. **Unnecessary dependency**: Coverage is a development/CI tool, not required for validating functionality. Users running tests to verify correct installation shouldn't need pytest-cov installed. 2. **Compatibility concerns**: Coverage tools can be slow to adapt to new Python versions, potentially blocking early testing with Python alpha/beta releases. Having it as a hard requirement delays adoption. 3. **Build system conflicts**: Some distribution build systems (like Fedora's RPM packaging) have policies against running code quality tools during package builds, preferring to focus purely on functional testing. This change: - Removes coverage options from default pytest addopts - Moves pytest-cov to the 'lint' dependency group (alongside other code quality tools like ruff and mypy) - Updates GitHub Actions workflow to explicitly enable coverage with flags when needed for CI Benefits: - Developers can still collect coverage by passing `--cov=eip712` flags - CI/CD workflows remain unchanged (coverage still collected) - Easier for downstream packagers to run functional tests without installing/running quality tools - Clearer separation: test dependencies vs. development/quality dependencies This aligns with the principle that coverage is a quality metric for development, not a functional requirement for test execution. Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> Assisted-by: Claude (Anthropic) <https://claude.ai>
lemenkov
force-pushed
the
separate_cov_and_lint
branch
from
December 13, 2025 13:16
31ff80f to
ecfbf46
Compare
Member
|
You can run it without coverage via Not sure I share your concern, at the very least I wouldn't put it under linting tools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Move pytest-cov from default test options to optional lint group to make it easier for downstream users and packagers to run functional tests without requiring code quality/coverage tools.
fixes: #
How I did it
[tool.pytest.ini_options]addoptspytest-covfrom thetestdependency group to thelintgroup.github/workflows/test.yamlto explicitly pass coverage flags when needed:--group lintto the functional test job--cov --cov-branch --cov-report=term --cov-report=xml --cov=eip712--no-covfrom fuzzing job (no longer needed)How to verify it
Default pytest run (no coverage):
uv run --group test pytestThis should run tests without attempting to collect coverage.
With coverage (for CI/development):
uv run --group test --group lint pytest --cov=eip712 --cov-branch --cov-report=termThis should work as before, collecting coverage reports.
GitHub Actions:
All existing CI workflows should continue to work unchanged, still collecting coverage as configured.
Why this change?
Currently, pytest-cov runs automatically on every pytest invocation, which creates issues:
Unnecessary dependency: Coverage is a development/CI tool, not required for validating functionality. Users running tests to verify correct installation shouldn't need pytest-cov installed.
Compatibility concerns: Coverage tools can be slow to adapt to new Python versions, potentially blocking early testing with Python alpha/beta releases.
Build system conflicts: Some distribution build systems (like Fedora's RPM packaging) have policies against running code quality tools during package builds, preferring to focus purely on functional testing.
Clearer dependency separation: This aligns with the existing structure where code quality tools (ruff, mypy) are in the
lintgroup, separate from functional test requirements.Benefits
pytestnow runs minimal, fast tests by defaultChecklist