Repository navigation
Parse complete numeric suffixes for order marker prefixes - #269
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #269 +/- ##
=======================================
Coverage 98.21% 98.21%
=======================================
Files 5 5
Lines 671 673 +2
Branches 143 143
=======================================
+ Hits 659 661 +2
Misses 3 3
Partials 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mrbean-bremen
left a comment
There was a problem hiding this comment.
Please also update the release notes.
| test_marker=f""" | ||
| import pytest | ||
|
|
||
| @getattr(pytest.mark, "my{suffix}") |
There was a problem hiding this comment.
I'm not very happy that this syntax is needed for negative markers, as this is not intuitive, and most users won't know it. Maybe it would make sense to add some placeholder for the minus (something like _neg or _minus) to make it easier to use (additionally to supporting actual negative numbers).
At least it would make sense to add a note to the documentation describing how negative numbers can be set in a marker.
There was a problem hiding this comment.
Thanks. I've added a neg placeholder: after the prefix, _neg1 or neg1 gives -1, so @pytest.mark.m_neg1 works without getattr. Literal negative suffixes still work. The configuration docs now explain both, and the release notes have an Unreleased entry. Happy to change the spelling to _minus if you prefer.
Document negative indices and add a release note.
Summary
Parse the complete suffix after
--order-marker-prefixas the integer order index. Multi-digit and negative indices now work, whilst bare prefixes and malformed suffixes are ignored by the existingValueErrorhandler. Explicitordermarkers retain precedence.Evidence
Risk
Ordering changes for prefixed markers with multi-digit, negative or malformed suffixes; ordinary
ordermarkers retain precedence.Unverified
None.