Not enforcing reason= with skipif/xfail markers
See original GitHub issueCurrently, when e.g. @pytest.mark.skipif(sys.platform != 'win32')
is used rather than @pytest.mark.skipif("sys.platform != 'win32'")
(condition as a string), pytest enforces that a reason="..."
is given.
As far as I can see, the only place that reason is used is with -rs
/-rx
which isn’t used by default anyways. In other places where pytest can show additional information (like docstrings in --fixtures
or descriptions in --markers
), we show some default value instead of enforcing the user to specify something.
I was wondering: Should pytest do the same for reason=
as well? Why not make it optional, and just report the location (without any description) in the skipped test summary for those cases?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Pytest not able to skip testcase in a class via marker skipif
With your example code, skipping tests via skipIf markers is not possible. First of all, let me clear the following: if you define...
Read more >Working with custom markers — pytest documentation
mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") ...
Read more >7. Incomplete and Skipped Tests — PHPUnit 9.5 Manual
This misinterpretation leads to the test reports being useless – you cannot see whether a test is actually successful or just not yet...
Read more >All the reasons you'll fail your driving test
Disobeying traffic signs, signals and road markings. Not stopping with all of your vehicle behind the line at a red traffic light; Driving...
Read more >unittest — Unit testing framework — Python 3.11.1 ...
Unittest supports skipping individual test methods and even whole classes of tests. In addition, it supports marking a test as an “expected failure,”...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Probably possible but not pretty. Reminds me of things Hypothesis does. Money quote:
and
Closing per discussion.