-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
type: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously
Description
Because 3.0 disallows pytest.skip
at module-level, using pytest.importorskip
fails:
import pytest
foobarbaz = pytest.importorskip("foobarbaz")
def test_foo():
pass
with 2.9.2:
========================== test session starts ===========================
platform linux -- Python 3.5.2, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/florian, inifile:
plugins: mock-1.2
collected 0 items / 1 skipped
with 3.0.0:
========================== test session starts ===========================
platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
rootdir: /home/florian, inifile:
plugins: hypothesis-2.0.0, catchlog-1.2.1
collected 0 items / 1 errors
================================= ERRORS =================================
_________________________ ERROR collecting x.py __________________________
Using @pytest.skip outside a test (e.g. as a test function decorator) is not allowed. Use @pytest.mark.skip or @pytest.mark.skipif instead.
!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!
======================== 1 error in 0.13 seconds =========================
This was pointed out in #pylib
by @jaraco as setuptools did run into it: test_msvc.py
I think this is a valid pattern (and the error message is confusing) - maybe pytest.skip
should have some allow_module_level
argument and importorskip
should use it (without me actually having looked at the code)?
cc @omarkohl
Metadata
Metadata
Assignees
Labels
type: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously