summaryrefslogtreecommitdiff
path: root/src/zope/interface/tests/test_ro.py
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2021-03-15 15:42:22 -0500
committerJason Madden <jamadden@gmail.com>2021-03-15 15:42:22 -0500
commit4e6bbd3db3d010122052cff117804bb282473d41 (patch)
treeb6ff6c29ca5d20455fac55b1b8cf54ec2360f7ad /src/zope/interface/tests/test_ro.py
parentdd69666aae99afe0d47b3af81149fbd7e97f59fe (diff)
downloadzope-interface-issue229.tar.gz
Make ZOPE_INTERFACE_STRICT_IRO imply ZOPE_INTERFACE_LOG_CHANGED_IRO.issue229
This helps diagnosing problems when just strict mode isn't enough, and strict mode is the one that's being used most of the time. Fixes #229
Diffstat (limited to 'src/zope/interface/tests/test_ro.py')
-rw-r--r--src/zope/interface/tests/test_ro.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/zope/interface/tests/test_ro.py b/src/zope/interface/tests/test_ro.py
index 61f92b6..a1e6947 100644
--- a/src/zope/interface/tests/test_ro.py
+++ b/src/zope/interface/tests/test_ro.py
@@ -221,6 +221,9 @@ class Test_c3_ro(Test_ro):
if hasattr(A, 'mro'):
self.assertEqual(A.mro(), self._callFUT(A))
+ # Clear anything the ro module logged by default,
+ # which might depend on environment variables.
+ self.log_handler.clear()
return A
def test_complex_diamond_interface(self):
@@ -252,6 +255,27 @@ class Test_c3_ro(Test_ro):
self.assertEqual(tuple(computed_A_iro), A.__iro__)
self._check_handler_complex_diamond()
+ def test_complex_diamond_strict_argument(self):
+ from zope.interface import Interface
+
+ A = self.test_complex_diamond(Interface)
+ computed_A_iro = self._callFUT(A, strict=True)
+ # It matches, of course, but strict mode implies
+ # that we also log changes.
+ self.assertEqual(tuple(computed_A_iro), A.__iro__)
+ self._check_handler_complex_diamond()
+
+ def test_complex_diamond_strict_and_log_arguments(self):
+ from zope.interface import Interface
+
+ A = self.test_complex_diamond(Interface)
+ computed_A_iro = self._callFUT(A, strict=True, log_changed_ro=False)
+ # It matches, of course...
+ self.assertEqual(tuple(computed_A_iro), A.__iro__)
+ # ...but because we explicitly set log_changed_ro to False,
+ # nothing is logged
+ self.assertFalse(self.log_handler.records)
+
def _check_handler_complex_diamond(self):
handler = self.log_handler
self.assertEqual(1, len(handler.records))