Skip to content

Include skipped tests in the output #5551

Answered by nicoddemus
bsipocz asked this question in General
Discussion options

You must be logged in to vote

Hi @bsipocz,

Thanks for following up with an issue.

I don't think this is simple to achieve today, I'm afraid. Both pytest.skip and pytest.importorskip work by raising an exception during import, which prevents the rest of the module from being processed.

Note that this behavior might still be achieved today through this slightly more verbose code:

try:
    import asd.util
except ImportError as e:
    pytestmark = pytest.mark.skip(reason=str(e))

Instead of:

asd = pytest.importorskip('asd.util')

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by nicoddemus
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@bilderbuchi
Comment options

@nicoddemus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #5551 on October 23, 2020 22:04.