Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #33 by preventing redundant test execution when both module-level (pytestmark) and function-level (@pytest.mark.isolated) markers are applied to the same test. The fix introduces logic to detect function-level markers and prioritize them over inherited module/class markers for test grouping.
Changes:
- Added marker precedence logic to prevent duplicate test runs when overlapping markers are present
- Added comprehensive tests to verify correct behavior with overlapping markers and proper failure reporting
- Bumped version to 0.4.4 to reflect the bug fix
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/pytest_isolated/grouping.py |
Added _has_own_isolated_marker() helper and logic to prioritize function-level markers when determining test grouping |
tests/test_grouping.py |
Added two tests: one verifying failure output is correctly associated with failing tests, and another validating that overlapping markers don't cause duplicate test runs |
src/pytest_isolated/__init__.py |
Version bump from 0.4.3 to 0.4.4 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @pytest.mark.isolated(group="custom") | ||
| def test_both_markers_with_group(): | ||
| # Explicit group on function marker wins over module scope. |
There was a problem hiding this comment.
ok. that policy is reasonable.
MINOR: Just to twist the twist ... out of curisoity, what happens if someone marks multiple times ...
@pytest.mark.isolated(group="g0")
@pytest.mark.isolated(group="g1")
@pytest.mark.isolated
def test_it():
..There was a problem hiding this comment.
It would use group "g0". Decorators apply bottom-up
There was a problem hiding this comment.
Actually, I tested it and the first (bottom) marker always wins. get_closest_marker returns the closest marker - the first decorator is the closest.
pcrespov
left a comment
There was a problem hiding this comment.
thx! This solves the issue. Left some thoughts.
fixes #33