[Zodb-checkins] CVS: Zope3/src/zope/interface/tests -
test_declarations.py:1.9
Jim Fulton
jim at zope.com
Tue Sep 23 15:12:37 EDT 2003
Update of /cvs-repository/Zope3/src/zope/interface/tests
In directory cvs.zope.org:/tmp/cvs-serv19709/src/zope/interface/tests
Modified Files:
test_declarations.py
Log Message:
Updated a test to prevent it from causing other tests to break.
A test was testing asserting interfaces for built-in types. It tried
to clean up after itself, but it's cleanup caused a central interface
registry to be cleared that shouldn't have been. This caused non-test
interface declarations to be lost.
Changed the test to be much more careful about returning the affected
registry to the state it was in before the test. Unfortunately, this
makes the test depend on some implementation details, although not
more so than before.
=== Zope3/src/zope/interface/tests/test_declarations.py 1.8 => 1.9 ===
--- Zope3/src/zope/interface/tests/test_declarations.py:1.8 Fri Aug 15 20:44:48 2003
+++ Zope3/src/zope/interface/tests/test_declarations.py Tue Sep 23 15:12:36 2003
@@ -130,6 +130,13 @@
)
def test_builtins(self):
+ # Setup
+ from zope.interface.declarations import _implements_reg
+ oldint = _implements_reg.get(int)
+ if oldint:
+ del _implements_reg[int]
+
+
classImplements(int, I1)
class myint(int):
implements(I2)
@@ -144,12 +151,15 @@
['I3', 'I2', 'I1'])
# cleanup
- from zope.interface.declarations import _implements_reg
- _implements_reg.clear()
+ del _implements_reg[int]
x = 42
self.assertEqual([i.getName() for i in providedBy(x)],
[])
+
+ # cleanup
+ if oldint is not None:
+ _implements_reg[int] = oldint
def test_signature_w_no_class_interfaces():
More information about the Zodb-checkins
mailing list