summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Howitz <mh@gocept.com>2021-05-05 15:28:09 +0200
committerGitHub <noreply@github.com>2021-05-05 15:28:09 +0200
commit077ff5b322b7ae8103f8ab034b0662d9202e016c (patch)
treee035d26bacf19a7e2d2c7a4ae600fe1ad582e038
parent7928bb337425c4a905eabf8697001abc634ff788 (diff)
downloadzope-interface-077ff5b322b7ae8103f8ab034b0662d9202e016c.tar.gz
Fix the documentation so it can be tested with `ZOPE_INTERFACE_STRICT_IRO=1`. (#242)
Closes #241.
-rw-r--r--.github/workflows/tests.yml2
-rw-r--r--docs/api/declarations.rst6
-rw-r--r--docs/verify.rst8
-rw-r--r--tox.ini2
4 files changed, 11 insertions, 7 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index f11865b..f0f4177 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -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
diff --git a/docs/api/declarations.rst b/docs/api/declarations.rst
index 4327c72..57c11f0 100644
--- a/docs/api/declarations.rst
+++ b/docs/api/declarations.rst
@@ -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]
diff --git a/docs/verify.rst b/docs/verify.rst
index 6a313cd..bc1be1c 100644
--- a/docs/verify.rst
+++ b/docs/verify.rst
@@ -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
diff --git a/tox.ini b/tox.ini
index dbdebff..3394e79 100644
--- a/tox.ini
+++ b/tox.ini
@@ -65,5 +65,3 @@ commands =
deps =
Sphinx
repoze.sphinx.autointerface
-setenv =
- ZOPE_INTERFACE_STRICT_IRO=0