Include skipped tests in the output #5551
-
Currently if a whole test file is skipped at discovery time with either |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @bsipocz, Thanks for following up with an issue. I don't think this is simple to achieve today, I'm afraid. Both 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') |
Beta Was this translation helpful? Give feedback.
-
Just came here because I also hit this behaviour - it was surprising to me that a skipped module seems to not be collected, as its tests don't show up in the report - it's as if the whole test module is not there. This does not mesh with my understanding of skipping in pytest. I was checking if I made a mistake in the test harness structure or whatnot which made the tests undiscoverable, until I started googling. (I used |
Beta Was this translation helpful? Give feedback.
-
@bilderbuchi but does the workaround of using |
Beta Was this translation helpful? Give feedback.
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
andpytest.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:
Instead of: