Skip to content

Commit

Permalink
Auto-skip zope tests if zope.interface not present
Browse files Browse the repository at this point in the history
This is a little more error-prone, but it's much more convenient to
invoke, since it doesn't involve skipping the "zope" marker.
  • Loading branch information
pganssle committed Sep 2, 2020
1 parent 4cf1da2 commit 74e8589
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions tests/test_validators.py
Expand Up @@ -30,8 +30,13 @@

@pytest.fixture(scope="module")
def zope():
import zope
import zope.interface
try:
import zope
import zope.interface
except ImportError:
raise pytest.skip(
"zope-related tests skipped when zope.interface is not installed"
)

return zope

Expand Down Expand Up @@ -239,7 +244,6 @@ def f():
return IFoo


@pytest.mark.zope
class TestProvides(object):
"""
Tests for `provides`.
Expand Down
1 change: 0 additions & 1 deletion tox.ini
@@ -1,7 +1,6 @@
[pytest]
addopts = -ra
testpaths = tests
markers = zope
filterwarnings =
once::Warning
ignore:::pympler[.*]
Expand Down

0 comments on commit 74e8589

Please sign in to comment.