-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Description
I would like to delay skipping tests to the end of the test execution. To do so, I yield from a fixture and call pytest.skip afterwards. This is part of a more complex fixture, but boils down to a minimal example of:
@pytest.fixture()
def post_exec():
params = {'skip': False}
yield params
if params['skip']:
pytest.skip('This is skipped')
def test_skip(post_exec):
post_exec['skip'] = True
# do further stuff
Expected result: The test is skipped.
Actual result: The test appears twice in the statistics
pytest tests/test_x.py::test_skip --v
[...]
tests/test_x.py::test_skip PASSED [100%]
tests/test_x.py::test_skip SKIPPED (This is skipped) [100%]
================================================ short test summary info =================================================
SKIPPED [1] tests/text_x.py:207: This is skipped
============================================== 1 passed, 1 skipped in 0.02s ==============================================
Tested with pytest 6.4.2.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch