Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
Remove non-persistent stuff from weakref tests for factoring out into
Browse files Browse the repository at this point in the history
a separate test included in a patch in:

http://www.zope.org/Collectors/Zope3-dev/750
  • Loading branch information
rpatterson committed Jan 27, 2007
1 parent d99ea0c commit bfdd211
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions tests/test_interface.py
Expand Up @@ -110,39 +110,28 @@ def test_provides(self):
bar = root['bar']
self.assertTrue(barmodule.IBar.providedBy(bar))

def test_weakref(self):
def test_persistentWeakref(self):
"""Verify interacton of declaration weak refs with ZODB
Weak references to persistent objects don't remain after ZODB
pack and garbage collection."""

bar = self.root['bar'] = Bar()
baz = self.root['baz'] = Baz()

self.registry.newModule("barmodule", bar_code)
barmodule = self.registry.findModule("barmodule")

self.assertEqual(IQux.dependents.keys(), [])
self.assertEqual(barmodule.IBar.dependents.keys(), [])

directlyProvides(baz, IQux)
directlyProvides(bar, barmodule.IBar)

self.assertEqual(len(IQux.dependents), 1)
self.assertEqual(len(barmodule.IBar.dependents), 1)

transaction.commit()
del bar
del self.root['bar']
del baz
del self.root['baz']
self.db.pack()
transaction.commit()
collect()

root = self.db.open().root()
barmodule = root['registry'].findModule("barmodule")

self.assertEqual(barmodule.IBar.dependents.keys(), [])

def test_persistentDeclarations(self):
Expand All @@ -165,7 +154,6 @@ class Baz(object):
bar.__provides__._Provides__args,
barmodule.IBar.dependents.keys()[0]._Provides__args
)

self.assertEqual(
Baz.__implemented__.__bases__,
barmodule.IBar.dependents.keys()[1].__bases__
Expand Down

0 comments on commit bfdd211

Please sign in to comment.