Skip to content

Commit

Permalink
Rename zope fixture to zope_interface, add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
pganssle committed Sep 2, 2020
1 parent 74e8589 commit 5f696a0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/test_validators.py
Expand Up @@ -29,16 +29,16 @@


@pytest.fixture(scope="module")
def zope():
def zope_interface():
"""Provides ``zope.interface`` if available, skipping the test if not."""
try:
import zope
import zope.interface
except ImportError:
raise pytest.skip(
"zope-related tests skipped when zope.interface is not installed"
)

return zope
return zope.interface


class TestInstanceOf(object):
Expand Down Expand Up @@ -230,8 +230,10 @@ class C(object):


@pytest.fixture(scope="module")
def ifoo(zope):
class IFoo(zope.interface.Interface):
def ifoo(zope_interface):
"""Provides a test ``zope.interface.Interface`` in ``zope`` tests."""

class IFoo(zope_interface.Interface):
"""
An interface.
"""
Expand All @@ -255,12 +257,12 @@ def test_in_all(self):
"""
assert provides.__name__ in validator_module.__all__

def test_success(self, zope, ifoo):
def test_success(self, zope_interface, ifoo):
"""
Nothing happens if value provides requested interface.
"""

@zope.interface.implementer(ifoo)
@zope_interface.implementer(ifoo)
class C(object):
def f(self):
pass
Expand Down

0 comments on commit 5f696a0

Please sign in to comment.