Commit fbc6b809 authored by Tres Seaver's avatar Tres Seaver

Make ZODB-/transaction-dependent functests conditional on their importability.

parent fa19073c
...@@ -90,32 +90,42 @@ Caches have a new_ghost method that: ...@@ -90,32 +90,42 @@ Caches have a new_ghost method that:
<<< cache.total_estimated_size # WTF? <<< cache.total_estimated_size # WTF?
0 0
Peristent meta classes work too:
>>> import ZODB.persistentclass
>>> class PC:
... __metaclass__ = ZODB.persistentclass.PersistentMetaClass
>>> PC._p_oid
>>> PC._p_jar
>>> PC._p_serial
>>> PC._p_changed
False
>>> cache.new_ghost('2', PC)
>>> PC._p_oid
'2'
>>> PC._p_jar is jar
True
>>> PC._p_serial
>>> PC._p_changed
False
""" """
if 0: # this test doesn't belong here! try:
import transaction
import ZODB
except ImportError:
pass
else:
def new_ghost_w_persistent_classes():
"""
Peristent meta classes work too:
>>> import persistent
>>> from persistent.tests.utils import ResettingJar
>>> jar = ResettingJar()
>>> cache = persistent.PickleCache(jar, 10, 100)
>>> import ZODB.persistentclass
>>> class PC:
... __metaclass__ = ZODB.persistentclass.PersistentMetaClass
>>> PC._p_oid
>>> PC._p_jar
>>> PC._p_serial
>>> PC._p_changed
False
>>> cache.new_ghost('2', PC)
>>> PC._p_oid
'2'
>>> PC._p_jar is jar
True
>>> PC._p_serial
>>> PC._p_changed
False
"""
def cache_invalidate_and_minimize_used_to_leak_None_ref(): def cache_invalidate_and_minimize_used_to_leak_None_ref():
"""Persistent weak references """Persistent weak references
......
...@@ -19,7 +19,13 @@ else: ...@@ -19,7 +19,13 @@ else:
from doctest import DocTestSuite from doctest import DocTestSuite
def test_suite(): def test_suite():
return DocTestSuite('persistent.wref') try:
import transaction
import ZODB
except ImportError:
return unittest.TestSuite()
else:
return DocTestSuite('persistent.wref')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment