Commit 39ad8b1c authored by Tres Seaver's avatar Tres Seaver

Remove last ZODB-dependent test.

parent 3289af84
......@@ -4,6 +4,8 @@
4.0 (unreleased)
-----------------
- Removed all ``ZODB``-dependent tests.
- Added explicit support for Python 3.2 and PyPy.
- Note that the C implementations of Persistent, PickleCache, and Timestamp
......
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import unittest
try:
import transaction
import ZODB
except ImportError:
HAVE_ZODB = False
else:
HAVE_ZODB = True
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():
"""Persistent weak references
>>> import transaction
>>> import ZODB.tests.util
>>> db = ZODB.tests.util.DB()
>>> conn = db.open()
>>> conn.root.p = p = conn.root().__class__()
>>> transaction.commit()
>>> import sys
>>> old = sys.getrefcount(None)
>>> conn._cache.invalidate(p._p_oid)
>>> sys.getrefcount(None) - old
0
>>> _ = conn.root.p.keys()
>>> old = sys.getrefcount(None)
>>> conn._cache.minimize()
>>> sys.getrefcount(None) - old
0
>>> db.close()
"""
def test_suite():
from doctest import DocTestSuite
if HAVE_ZODB:
return unittest.TestSuite((
DocTestSuite(),
))
return unittest.TestSuite()
......@@ -23,9 +23,6 @@ from setuptools import Extension
from setuptools import find_packages
from setuptools import setup
TESTS_REQUIRE = [
]
here = os.path.abspath(os.path.dirname(__file__))
README = (open(os.path.join(here, 'README.txt')).read()
+ '\n\n' +
......@@ -97,10 +94,9 @@ setup(name='persistent',
zip_safe=False,
ext_modules = ext_modules,
headers = headers,
tests_require = TESTS_REQUIRE,
extras_require = {
'test': TESTS_REQUIRE,
'testing': TESTS_REQUIRE + ['nose', 'coverage'],
'test': (),
'testing': ['nose', 'coverage'],
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
},
test_suite="persistent.tests",
......@@ -109,5 +105,4 @@ setup(name='persistent',
],
entry_points = """\
"""
)
)
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