Commit 3ea253ad authored by Jim Fulton's avatar Jim Fulton

Use doctest rather than zope.testing.doctest.

parent fad58f34
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import doctest
import unittest import unittest
from zope.testing import doctest
def test_fsbucket_string_conversion(): def test_fsbucket_string_conversion():
""" """
......
...@@ -11,12 +11,8 @@ ...@@ -11,12 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""XXX short summary goes here. import doctest, re, unittest
from zope.testing import renormalizing
$Id$
"""
import re, unittest
from zope.testing import doctest, renormalizing
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
The actual tests are in ConnectionTests.py; this file provides the The actual tests are in ConnectionTests.py; this file provides the
platform-dependent scaffolding. platform-dependent scaffolding.
""" """
from ZEO.tests import ConnectionTests, InvalidationTests from ZEO.tests import ConnectionTests, InvalidationTests
from zope.testing import doctest, setupstack from zope.testing import setupstack
import doctest
import unittest import unittest
import ZEO.tests.forker import ZEO.tests.forker
import ZEO.tests.testMonitor import ZEO.tests.testMonitor
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import doctest
import unittest import unittest
from zope.testing import doctest
class FakeStorageBase: class FakeStorageBase:
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
from zope.testing import doctest, setupstack, renormalizing from zope.testing import setupstack, renormalizing
import doctest
import logging import logging
import pprint import pprint
import re import re
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"""Basic unit tests for a client cache.""" """Basic unit tests for a client cache."""
from ZODB.utils import p64, repr_to_oid from ZODB.utils import p64, repr_to_oid
from zope.testing import doctest import doctest
import os import os
import random import random
import string import string
......
...@@ -11,10 +11,8 @@ ...@@ -11,10 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
from zope.testing import doctest
import cPickle import cPickle
import doctest
import os import os
import time import time
import transaction import transaction
......
...@@ -11,17 +11,15 @@ ...@@ -11,17 +11,15 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Test harness for scripts. import doctest
$Id$
"""
import unittest
import re import re
from zope.testing import doctest, renormalizing import unittest
import ZODB.tests.util import ZODB.tests.util
import zope.testing.renormalizing
checker = renormalizing.RENormalizing([ checker = zope.testing.renormalizing.RENormalizing([
(re.compile('[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+'), (re.compile(
'[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+'),
'2007-11-10 15:18:48.543001'), '2007-11-10 15:18:48.543001'),
(re.compile('hash=[0-9a-f]{40}'), (re.compile('hash=[0-9a-f]{40}'),
'hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3')]) 'hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3')])
......
...@@ -22,8 +22,8 @@ from ZODB.serialize import referencesf ...@@ -22,8 +22,8 @@ from ZODB.serialize import referencesf
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
from ZODB.tests.MTStorage import TestThread from ZODB.tests.MTStorage import TestThread
from ZODB.tests.StorageTestBase import snooze from ZODB.tests.StorageTestBase import snooze
from zope.testing import doctest
import cPickle import cPickle
import doctest
import time import time
import transaction import transaction
import ZODB.interfaces import ZODB.interfaces
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
# #
############################################################################## ##############################################################################
"""Sample objects for use in tests """Sample objects for use in tests
$Id$
""" """
class DataManager(object): class DataManager(object):
...@@ -405,7 +403,7 @@ class Rollback(object): ...@@ -405,7 +403,7 @@ class Rollback(object):
def test_suite(): def test_suite():
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
return DocTestSuite() return DocTestSuite()
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -12,15 +12,13 @@ ...@@ -12,15 +12,13 @@
# #
############################################################################## ##############################################################################
"""Test broken-object suppport """Test broken-object suppport
$Id$
""" """
import sys import sys
import unittest import unittest
import persistent import persistent
import transaction import transaction
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
from ZODB.tests.util import DB from ZODB.tests.util import DB
def test_integration(): def test_integration():
......
...@@ -23,7 +23,7 @@ from persistent import Persistent ...@@ -23,7 +23,7 @@ from persistent import Persistent
from persistent.mapping import PersistentMapping from persistent.mapping import PersistentMapping
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
from ZODB.utils import p64 from ZODB.utils import p64
from zope.testing import doctest import doctest
import gc import gc
import threading import threading
import time import time
......
...@@ -11,14 +11,10 @@ ...@@ -11,14 +11,10 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Tests of savepoint feature import doctest
$Id$
"""
import unittest
from zope.testing import doctest
import persistent.mapping import persistent.mapping
import transaction import transaction
import unittest
def testAddingThenModifyThenAbort(): def testAddingThenModifyThenAbort():
"""\ """\
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
############################################################################## ##############################################################################
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
from zope.testing import doctest
import datetime import datetime
import doctest
import os import os
import sys import sys
import time import time
......
...@@ -11,15 +11,7 @@ ...@@ -11,15 +11,7 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import unittest
import random
import transaction
from ZODB.DB import DB from ZODB.DB import DB
from zope.testing import doctest
import ZODB.tests.hexstorage
import ZODB.tests.util
import ZODB.utils
import ZODB.DemoStorage
from ZODB.tests import ( from ZODB.tests import (
BasicStorage, BasicStorage,
HistoryStorage, HistoryStorage,
...@@ -30,6 +22,14 @@ from ZODB.tests import ( ...@@ -30,6 +22,14 @@ from ZODB.tests import (
StorageTestBase, StorageTestBase,
Synchronization, Synchronization,
) )
import doctest
import random
import transaction
import unittest
import ZODB.DemoStorage
import ZODB.tests.hexstorage
import ZODB.tests.util
import ZODB.utils
class DemoStorageTests( class DemoStorageTests(
StorageTestBase.StorageTestBase, StorageTestBase.StorageTestBase,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# #
############################################################################## ##############################################################################
import cPickle import cPickle
import doctest
import os, unittest import os, unittest
import transaction import transaction
import ZODB.FileStorage import ZODB.FileStorage
...@@ -657,8 +658,6 @@ def pack_with_open_blob_files(): ...@@ -657,8 +658,6 @@ def pack_with_open_blob_files():
""" """
def test_suite(): def test_suite():
from zope.testing import doctest
suite = unittest.TestSuite() suite = unittest.TestSuite()
for klass in [ for klass in [
FileStorageTests, FileStorageHexTests, FileStorageTests, FileStorageHexTests,
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Tests of the serializer.""" import doctest
import cPickle import cPickle
import cStringIO as StringIO import cStringIO as StringIO
import sys import sys
...@@ -121,7 +120,6 @@ class SerializerTestCase(unittest.TestCase): ...@@ -121,7 +120,6 @@ class SerializerTestCase(unittest.TestCase):
def test_suite(): def test_suite():
from zope.testing import doctest
suite = unittest.makeSuite(SerializerTestCase) suite = unittest.makeSuite(SerializerTestCase)
suite.addTest(doctest.DocTestSuite("ZODB.serialize")) suite.addTest(doctest.DocTestSuite("ZODB.serialize"))
return suite return suite
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
############################################################################## ##############################################################################
"""Test the routines to convert between long and 64-bit strings""" """Test the routines to convert between long and 64-bit strings"""
from persistent import Persistent
import doctest
import random import random
import unittest import unittest
from persistent import Persistent
from zope.testing import doctest
NUM = 100 NUM = 100
......
...@@ -12,12 +12,10 @@ ...@@ -12,12 +12,10 @@
# #
############################################################################## ##############################################################################
"""Test behavior of Connection plus cPickleCache.""" """Test behavior of Connection plus cPickleCache."""
from zope.testing import doctest
from persistent import Persistent from persistent import Persistent
import transaction
from ZODB.config import databaseFromString from ZODB.config import databaseFromString
import doctest
import transaction
class RecalcitrantObject(Persistent): class RecalcitrantObject(Persistent):
"""A Persistent object that will not become a ghost.""" """A Persistent object that will not become a ghost."""
......
...@@ -11,11 +11,8 @@ ...@@ -11,11 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""
$Id$
"""
import unittest import unittest
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
from transaction._transaction import DataManagerAdapter from transaction._transaction import DataManagerAdapter
from ZODB.tests.sampledm import DataManager from ZODB.tests.sampledm import DataManager
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import doctest
import unittest import unittest
from zope.testing import doctest
__test__ = dict( __test__ = dict(
cross_db_refs_to_blank_db_name = """ cross_db_refs_to_blank_db_name = """
There was a bug that caused bad refs to be generated is a database There was a bug that caused bad refs to be generated is a database
name was blank. name was blank.
...@@ -38,7 +37,7 @@ __test__ = dict( ...@@ -38,7 +37,7 @@ __test__ = dict(
>>> list(conn2.root()[0].keys()) >>> list(conn2.root()[0].keys())
[] []
""", """,
) )
......
...@@ -67,7 +67,7 @@ Clean up. ...@@ -67,7 +67,7 @@ Clean up.
>>> st.close() >>> st.close()
""" """
from zope.testing import doctest import doctest
import zope.testing.setupstack import zope.testing.setupstack
def test_suite(): def test_suite():
......
...@@ -11,12 +11,9 @@ ...@@ -11,12 +11,9 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
""" import doctest
$Id$
"""
import unittest
from zope.testing import doctest
import persistent import persistent
import unittest
class MyClass(persistent.Persistent): class MyClass(persistent.Persistent):
pass pass
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
r""" r"""
fsoids test, of the workhorse fsoids.Trace class fsoids test, of the workhorse fsoids.Trace class
================================================ ================================================
...@@ -168,7 +167,7 @@ Clean up. ...@@ -168,7 +167,7 @@ Clean up.
>>> st.cleanup() # remove .fs, .index, etc >>> st.cleanup() # remove .fs, .index, etc
""" """
from zope.testing import doctest import doctest
def test_suite(): def test_suite():
return doctest.DocTestSuite() return doctest.DocTestSuite()
...@@ -402,7 +402,7 @@ True ...@@ -402,7 +402,7 @@ True
1 1
""" """
from zope.testing import doctest import doctest
def test_suite(): def test_suite():
return doctest.DocTestSuite() return doctest.DocTestSuite()
...@@ -11,17 +11,13 @@ ...@@ -11,17 +11,13 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""ZClass tests import doctest
import os
$Id$ import sys
"""
import os, sys
import unittest
import ZODB.tests.util
import transaction import transaction
from zope.testing import doctest import unittest
import ZODB.persistentclass import ZODB.persistentclass
import ZODB.tests.util
def class_with_circular_ref_to_self(): def class_with_circular_ref_to_self():
""" """
...@@ -41,7 +37,7 @@ It should be possible for a class to reger to itself. ...@@ -41,7 +37,7 @@ It should be possible for a class to reger to itself.
>>> c = C2() >>> c = C2()
>>> c.__class__.__name__ >>> c.__class__.__name__
'C' 'C'
""" """
# XXX need to update files to get newer testing package # XXX need to update files to get newer testing package
......
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Unit tests for PickleCache
$Id$
"""
class DummyConnection: class DummyConnection:
...@@ -114,7 +110,7 @@ Peristent meta classes work too: ...@@ -114,7 +110,7 @@ Peristent meta classes work too:
""" """
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
import unittest import unittest
def test_suite(): def test_suite():
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import doctest
import unittest import unittest
from zope.testing import doctest, setupstack from zope.testing import setupstack
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
This module tests and documents, through example, overriding attribute This module tests and documents, through example, overriding attribute
access methods. access methods.
$Id$
""" """
from persistent import Persistent # ouch! from persistent import Persistent # ouch!
...@@ -379,5 +377,5 @@ class SampleOverridingGetattributeSetattrAndDelattr(Persistent): ...@@ -379,5 +377,5 @@ class SampleOverridingGetattributeSetattrAndDelattr(Persistent):
def test_suite(): def test_suite():
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
return DocTestSuite() return DocTestSuite()
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import unittest
from zope.testing import doctest
from persistent import Persistent, simple_new from persistent import Persistent, simple_new
import doctest
import unittest
class P(Persistent): class P(Persistent):
def __init__(self): def __init__(self):
......
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Basic pickling tests
$Id$
"""
from persistent import Persistent from persistent import Persistent
import pickle import pickle
...@@ -269,7 +264,7 @@ def test_pickling_w_slots_w_empty_dict(): ...@@ -269,7 +264,7 @@ def test_pickling_w_slots_w_empty_dict():
""" """
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
import unittest import unittest
def test_suite(): def test_suite():
......
...@@ -11,11 +11,8 @@ ...@@ -11,11 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""
$Id$
"""
import unittest import unittest
from zope.testing.doctest import DocTestSuite from doctest import DocTestSuite
def test_suite(): def test_suite():
return DocTestSuite('persistent.wref') return DocTestSuite('persistent.wref')
......
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