-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Description
Bud Description
When using pytest.importorskip
as a decorator on a specific test in a test file, the all of the the tests in the file, rather than just the decorated test, are skipped.
For example:
# contents of test_it,py
import pytest
@pytest.importorskip('a_module_that_isnt_installed')
def tests_one():
assert 1
def test_two():
assert 0
when running:
pytest test_it.py -rsx
I get the following output:
============================= test session starts ==============================
platform linux -- Python 3.10.2, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/derrick/python_scratch_space/importorskip
collected 0 items / 1 skipped
=========================== short test summary info ============================
SKIPPED [1] test_it.py:3: could not import 'a_module_that_isnt_installed': No module named 'a_module_that_isnt_installed'
============================== 1 skipped in 0.00s ==============================
However, I would expect test_two to still be collected and run.
Version Info
Package Version
---------- -------
attrs 21.4.0
iniconfig 1.1.1
packaging 21.3
pip 21.3.1
pluggy 1.0.0
py 1.11.0
pyparsing 3.0.7
pytest 6.2.5
setuptools 60.5.0
toml 0.10.2
wheel 0.37.1
pytest 6.2.5,
python 10.2
ubuntu 20.04
Metadata
Metadata
Assignees
Labels
No labels