diff options
| author | Jason Madden <jason+github@nextthought.com> | 2017-06-12 09:05:13 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-12 09:05:13 -0500 |
| commit | 1f00dcfa8e7f4cc2e5706c9af44f1cab20b22d88 (patch) | |
| tree | 8d25ad07ece5b56952f6abd69d37d4d2e81ffda9 /src/zope/interface/declarations.py | |
| parent | e6b6ba2181e2265fa814a34a119531b1ddca23bf (diff) | |
| download | zope-interface-1f00dcfa8e7f4cc2e5706c9af44f1cab20b22d88.tar.gz | |
100% coverage (#90)
* Get as close to 100% coverage as possible.
Without conflicting with #86.
This is almost entirely trivial changes:
- Make dummy methods that should never be called either raise
NotImplementedError or call self.fail() in tests.
- Standardize the no-coverage pragma
- Add a few pragmas where coverage varies across
versions/implementations, mostly for the sake of tox (travis should
hit them all).
* Convert tox to run the coverage command, like travis. A follow up should have it produce coverage for all python versions/implementations.
Fixes #87
* Adjust coverage config for py2 only tests; fix typo; finish replacing self with cls
Diffstat (limited to 'src/zope/interface/declarations.py')
| -rw-r--r-- | src/zope/interface/declarations.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/zope/interface/declarations.py b/src/zope/interface/declarations.py index 8ea56b9..13433bd 100644 --- a/src/zope/interface/declarations.py +++ b/src/zope/interface/declarations.py @@ -436,7 +436,7 @@ class implementer_only: def _implements(name, interfaces, classImplements): # This entire approach is invalid under Py3K. Don't even try to fix # the coverage for this block there. :( - if PYTHON3: #pragma NO COVER + if PYTHON3: # pragma: no cover raise TypeError('Class advice impossible in Python3') frame = sys._getframe(2) locals = frame.f_locals @@ -481,7 +481,7 @@ def implements(*interfaces): """ # This entire approach is invalid under Py3K. Don't even try to fix # the coverage for this block there. :( - if PYTHON3: #pragma NO COVER + if PYTHON3: # pragma: no cover raise TypeError(_ADVICE_ERROR % 'implementer') _implements("implements", interfaces, classImplements) @@ -509,7 +509,7 @@ def implementsOnly(*interfaces): """ # This entire approach is invalid under Py3K. Don't even try to fix # the coverage for this block there. :( - if PYTHON3: #pragma NO COVER + if PYTHON3: # pragma: no cover raise TypeError(_ADVICE_ERROR % 'implementer_only') _implements("implementsOnly", interfaces, classImplementsOnly) @@ -581,7 +581,7 @@ def directlyProvides(object, *interfaces): # Note that we can't get here from Py3k tests: there is no normal # class which isn't descriptor aware. if not isinstance(object, - DescriptorAwareMetaClasses): #pragma NO COVER Py3k + DescriptorAwareMetaClasses): # pragma: no cover Py3k raise TypeError("Attempt to make an interface declaration on a " "non-descriptor-aware class") @@ -641,9 +641,9 @@ ClassProvidesBase = ClassProvidesBaseFallback # Try to get C base: try: import zope.interface._zope_interface_coptimizations -except ImportError: #pragma NO COVERAGE +except ImportError: # pragma: no cover pass -else: #pragma NO COVERAGE +else: # pragma: no cover from zope.interface._zope_interface_coptimizations import ClassProvidesBase @@ -715,7 +715,7 @@ def classProvides(*interfaces): # This entire approach is invalid under Py3K. Don't even try to fix # the coverage for this block there. :( - if PYTHON3: #pragma NO COVER + if PYTHON3: # pragma: no cover raise TypeError(_ADVICE_ERROR % 'provider') frame = sys._getframe(1) @@ -801,7 +801,7 @@ def ObjectSpecification(direct, cls): These combine information for the object and for it's classes. """ - return Provides(cls, direct) #pragma NO COVER fossil + return Provides(cls, direct) # pragma: no cover fossil def getObjectSpecificationFallback(ob): @@ -918,9 +918,9 @@ _empty = Declaration() try: import zope.interface._zope_interface_coptimizations -except ImportError: #pragma NO COVER +except ImportError: # pragma: no cover pass -else: #pragma NO COVER PyPy +else: # pragma: no cover PyPy from zope.interface._zope_interface_coptimizations import implementedBy from zope.interface._zope_interface_coptimizations import providedBy from zope.interface._zope_interface_coptimizations import ( |
