Executing tests that have skip marks #13311
Unanswered
sashko1988
asked this question in
Q&A
Replies: 3 comments 5 replies
|
There's no builtin feature for that as typically that's done via xfail/run |
3 replies
|
Also, I can't find anything that allows to remove markers dynamically. The only related stuff I found is here - #3324 |
2 replies
|
Tested on pytest 8.x Python 3.11/3.12. # conftest.py
import pytest
def pytest_collection_modifyitems(config, items):
for item in items:
marks = [m for m in getattr(item, "own_markers", []) if m.name not in ("skip", "skipif")]
if len(marks) != len(getattr(item, "own_markers", [])):
item.own_markers[:] = marks
item.add_marker(pytest.mark.xfail(reason="was skip or skipif")) # drop this to run them normally
#should work fine with recent pytest versions
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is there a way to run tests with skip and skipif marks without changing tests code.
Example,
And I want
pytestto execute it without removing theskipdecorator in the code.Something like
All reactions