Fix the documentation so it can be tested with `ZOPE_INTERFACE_STRICT_IRO=1`. (#242)

Closes #241.
This commit is contained in:
Michael Howitz 2021-05-05 15:28:09 +02:00 committed by GitHub
parent 7928bb3374
commit 077ff5b322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -283,7 +283,7 @@ jobs:
pip install -U "`ls dist/zope.interface-*.whl`[docs]"
- name: Build docs
env:
ZOPE_INTERFACE_STRICT_IRO: 0
ZOPE_INTERFACE_STRICT_IRO: 1
run: |
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest

View File

@ -744,7 +744,7 @@ Exmples for :meth:`Declaration.__sub__`:
>>> spec -= I1
>>> [iface.getName() for iface in spec]
[]
>>> spec -= Declaration(I1, I2)
>>> spec -= Declaration(I2)
>>> [iface.getName() for iface in spec]
[]
>>> spec = Declaration(I2, I4)
@ -755,7 +755,7 @@ Exmples for :meth:`Declaration.__sub__`:
>>> [iface.getName() for iface in spec - I1]
['I4']
>>> [iface.getName() for iface
... in spec - Declaration(I3, I4)]
... in spec - Declaration(I4)]
['I2']
Exmples for :meth:`Declaration.__add__`:
@ -784,7 +784,7 @@ Exmples for :meth:`Declaration.__add__`:
['IRoot1']
>>> [iface.getName() for iface in spec2]
[]
>>> spec2 += Declaration(IRoot2, IDerived2)
>>> spec2 += Declaration(IDerived2, IRoot2)
>>> [iface.getName() for iface in spec2]
['IDerived2', 'IRoot2']
>>> [iface.getName() for iface in spec+spec2]

View File

@ -83,11 +83,17 @@ desired interface.
True
If all instances will provide the interface, we can
mark the class as implementing it.
mark a class as implementing it. But we have to remove the interface from the
instance first so a consistent interface resolution order can be achieved.
(Calling ``gc.collect()`` is also necessary because we use weakrefs.)
.. doctest::
>>> from zope.interface import classImplements
>>> from zope.interface import noLongerProvides
>>> import gc
>>> noLongerProvides(foo, IFoo)
>>> _ = gc.collect()
>>> classImplements(Foo, IFoo)
>>> verify_foo()
True

View File

@ -65,5 +65,3 @@ commands =
deps =
Sphinx
repoze.sphinx.autointerface
setenv =
ZOPE_INTERFACE_STRICT_IRO=0