Skip to content

Commit

Permalink
Dang git anyway.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Jan 17, 2013
1 parent 04a7051 commit 2b2cede
Show file tree
Hide file tree
Showing 51 changed files with 146 additions and 113 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Unreleased
==========

- Renamed the hard-to-grab module, ``ZODB.DB`` as ``ZODB.db``.
``ZODB.DB`` is now unambigously the ``DB`` class, imported as a convenience
api from the no-longer-shadowed ``ZODB.db``.

- Tests are now runnable via ``python setup.py test`` and via ``nose``.

- Added ``setup.py docs`` alias (installs ``Sphinx`` and
Expand Down
4 changes: 2 additions & 2 deletions src/ZODB/FileStorage/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def pack_keep_old():
The pack_keep_old constructor argument controls whether a .old file (and .old directory for blobs is kept.)
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> from ZODB.FileStorage import FileStorage
>>> from ZODB.blob import Blob
>>> fs = FileStorage('data.fs', blob_dir='blobs')
Expand Down Expand Up @@ -95,7 +95,7 @@ def pack_with_repeated_blob_records():
fixed by the time you read this, but there might still be
transactions in the wild that have duplicate records.
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> from ZODB.FileStorage import FileStorage
>>> from ZODB.blob import Blob
>>> fs = FileStorage('t', blob_dir='bobs')
Expand Down
1 change: 1 addition & 0 deletions src/ZODB/FileStorage/zconfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ create

To demonstrate this, we'll first write some data:

>>> import ZODB
>>> db = ZODB.DB(fs)
>>> conn = db.open()
>>> import ZODB.blob, transaction
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/MappingStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,5 @@ def __init__(self, oid, tid, data):
self.data = data

def DB(*args, **kw):
from ZODB.DB import DB
from ZODB.db import DB
return DB(MappingStorage(), *args, **kw)
6 changes: 4 additions & 2 deletions src/ZODB/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
sys.modules['ZODB.PersistentMapping'] = sys.modules['persistent.mapping']
sys.modules['ZODB.PersistentList'] = sys.modules['persistent.list']

del mapping, list, sys
from .db import DB, connection
# BBB alias
sys.modules['ZODB.DB'] = sys.modules['ZODB.db']

from DB import DB, connection
del mapping, list, sys
4 changes: 2 additions & 2 deletions src/ZODB/collaborations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Simple fetch, modify, commit
Participants
------------

- ``DB``: ``ZODB.DB.DB``
- ``DB``: ``ZODB.db.DB``
- ``C``: ``ZODB.Connection.Connection``
- ``S``: ``ZODB.FileStorage.FileStorage``
- ``T``: ``transaction.interfaces.ITransaction``
Expand Down Expand Up @@ -69,7 +69,7 @@ Simple fetch, modify, abort
Participants
------------

- ``DB``: ``ZODB.DB.DB``
- ``DB``: ``ZODB.db.DB``
- ``C``: ``ZODB.Connection.Connection``
- ``S``: ``ZODB.FileStorage.FileStorage``
- ``T``: ``transaction.interfaces.ITransaction``
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def open(self, database_name='unnamed', databases=None):
class ZODBDatabase(BaseConfig):

def open(self, databases=None):
from ZODB.DB import DB
from ZODB.db import DB
section = self.config
storage = section.storage.open()
options = {}
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/cross-database-references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Lets set up a multi-database with 2 databases:

>>> import persistent
>>> import transaction
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> databases = {}
>>> db1 = DB(None, databases=databases, database_name='1')
>>> db2 = DB(None, databases=databases, database_name='2')
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from persistent.TimeStamp import TimeStamp


logger = logging.getLogger('ZODB.DB')
logger = logging.getLogger('ZODB.db')

class AbstractConnectionPool(object):
"""Manage a pool of connections.
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/scripts/checkbtrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
and run them through BTrees.check.check().
"""

from ZODB.DB import DB
from ZODB.db import DB
from ZODB.FileStorag.FileStoragee import FileStorage
from BTrees.check import check

Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/scripts/netspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-v: print info for all objects, even if a traversal path isn't found
"""

from ZODB.DB import DB
from ZODB.db import DB
from ZODB.FileStorage import FileStorage
from ZODB.utils import U64, get_pickle_metadata
from ZODB.serialize import referencesf
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/scripts/tests/fstail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ transactions:
We have to prepare a FileStorage first:

>>> from ZODB.FileStorage import FileStorage
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> import transaction
>>> from tempfile import mktemp
>>> storagefile = mktemp()
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/scripts/tests/referrers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To see how this works, we'll create a small database:
>>> import transaction
>>> from persistent.mapping import PersistentMapping
>>> from ZODB.FileStorage import FileStorage
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> import os, tempfile
>>> dest = tempfile.mkdtemp()
>>> fs = FileStorage(os.path.join(dest, 'Data.fs'))
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/scripts/tests/test_fstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def test_fstest_verbose():
r"""
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> db = DB('data.fs')
>>> db.close()
>>> from ZODB.scripts.fstest import main
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/scripts/tests/test_repozo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, dir):
self.close()

def getdb(self):
from ZODB.DB import DB
from ZODB.db import DB
from ZODB.FileStorage.FileStorage import FileStorage
self._file_name = storage_filename = os.path.join(self.dir, 'Data.fs')
storage = FileStorage(storage_filename)
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/MTStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from persistent.mapping import PersistentMapping
import transaction

from ZODB.DB import DB
from ZODB.db import DB
from ZODB.tests.StorageTestBase import zodb_pickle, zodb_unpickle
from ZODB.tests.StorageTestBase import handle_serials
from ZODB.tests.MinPO import MinPO
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/PackableStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import transaction
import zope.testing.setupstack

from ZODB.DB import DB
from ZODB.db import DB
from ZODB.interfaces import IStorageIteration
from ZODB.POSException import ConflictError, StorageError
from ZODB.serialize import referencesf
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/RecoveryStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from transaction import Transaction
from ZODB.tests.IteratorStorage import IteratorDeepCompare
from ZODB.tests.StorageTestBase import MinPO, snooze
from ZODB.DB import DB
from ZODB.db import DB
from ZODB.serialize import referencesf

import time
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/TransactionalUndoStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from ZODB import POSException
from ZODB.serialize import referencesf
from ZODB.utils import p64
from ZODB.DB import DB
from ZODB.db import DB

from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_pickle, zodb_unpickle
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/blob_connection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FileStorage rather than MappingStorage here because we will want ``loadBefore``
for one of our examples.)

>>> blob_storage = create_storage()
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> database = DB(blob_storage)

Putting a Blob into a Connection works like every other object:
Expand Down
1 change: 1 addition & 0 deletions src/ZODB/tests/blob_importexport.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Import/export support for blob data

Set up:

>>> import ZODB
>>> import ZODB.blob, transaction
>>> from persistent.mapping import PersistentMapping

Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/blob_packing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Set up:
>>> from ZODB.serialize import referencesf
>>> from ZODB.blob import Blob
>>> from ZODB import utils
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> import transaction

A helper method to assure a unique timestamp across multiple platforms:
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/blob_tempdir.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ First, we need a datatabase with blob support::

>>> from ZODB.MappingStorage import MappingStorage
>>> from ZODB.blob import BlobStorage
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> import os.path
>>> base_storage = MappingStorage('test')
>>> blob_dir = os.path.abspath('blobs')
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/blob_transaction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Transaction support for Blobs

We need a database with a blob supporting storage::

>>> import ZODB.blob, transaction
>>> import ZODB, ZODB.blob, transaction
>>> blob_dir = 'blobs'
>>> blob_storage = create_storage(blob_dir=blob_dir)
>>> database = ZODB.DB(blob_storage)
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/blobstorage_packing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Set up:
>>> from ZODB.serialize import referencesf
>>> from ZODB.blob import Blob, BlobStorage
>>> from ZODB import utils
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> import transaction
>>> storagefile = 'Data.fs'
>>> blob_dir = 'blobs'
Expand Down
16 changes: 8 additions & 8 deletions src/ZODB/tests/dbopen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Here we exercise the connection management done by the DB class.
Capturing log messages from DB is important for some of the examples:

>>> from zope.testing.loggingsupport import InstalledHandler
>>> handler = InstalledHandler('ZODB.DB')
>>> handler = InstalledHandler('ZODB.db')

Create a storage, and wrap it in a DB wrapper:

Expand All @@ -31,7 +31,7 @@ Open one more, and we get a warning:
1
>>> msg = handler.records[0]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB WARNING DB.open() has 8 open connections with a pool_size of 7
ZODB.db WARNING DB.open() has 8 open connections with a pool_size of 7

Open 6 more, and we get 6 more warnings:

Expand All @@ -42,7 +42,7 @@ Open 6 more, and we get 6 more warnings:
7
>>> msg = handler.records[-1]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB WARNING DB.open() has 14 open connections with a pool_size of 7
ZODB.db WARNING DB.open() has 14 open connections with a pool_size of 7

Add another, so that it's more than twice the default, and the level
rises to critical:
Expand All @@ -54,7 +54,7 @@ rises to critical:
8
>>> msg = handler.records[-1]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB CRITICAL DB.open() has 15 open connections with a pool_size of 7
ZODB.db CRITICAL DB.open() has 15 open connections with a pool_size of 7

While it's boring, it's important to verify that the same relationships
hold if the default pool size is overridden.
Expand All @@ -75,7 +75,7 @@ A warning for opening one more:
1
>>> msg = handler.records[0]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB WARNING DB.open() has 3 open connections with a pool_size of 2
ZODB.db WARNING DB.open() has 3 open connections with a pool_size of 2

More warnings through 4 connections:

Expand All @@ -86,7 +86,7 @@ More warnings through 4 connections:
2
>>> msg = handler.records[-1]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB WARNING DB.open() has 4 open connections with a pool_size of 2
ZODB.db WARNING DB.open() has 4 open connections with a pool_size of 2

And critical for going beyond that:

Expand All @@ -97,7 +97,7 @@ And critical for going beyond that:
3
>>> msg = handler.records[-1]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB CRITICAL DB.open() has 5 open connections with a pool_size of 2
ZODB.db CRITICAL DB.open() has 5 open connections with a pool_size of 2

We can change the pool size on the fly:

Expand All @@ -111,7 +111,7 @@ We can change the pool size on the fly:
1
>>> msg = handler.records[0]
>>> print msg.name, msg.levelname, msg.getMessage()
ZODB.DB WARNING DB.open() has 7 open connections with a pool_size of 6
ZODB.db WARNING DB.open() has 7 open connections with a pool_size of 6

Enough of that.

Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/multidb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The database name is accessible afterwards and in a newly created collection:
>>> db.database_name
'root'
>>> db.databases # doctest: +ELLIPSIS
{'root': <ZODB.DB.DB object at ...>}
{'root': <ZODB.db.DB object at ...>}
>>> db.databases is dbmap
True

Expand Down
4 changes: 2 additions & 2 deletions src/ZODB/tests/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import sys, os, getopt, string, time
sys.path.insert(0, os.getcwd())

import ZODB.DB
import ZODB.db
import ZODB.FileStorage
import persistent
import transaction
Expand Down Expand Up @@ -77,7 +77,7 @@ def main(args):
s=ZODB.FileStorage.FileStorage('zeo_speed.fs', create=1)

data=open(data).read()
db=ZODB.DB.DB(s,
db=ZODB.db.DB(s,
# disable cache deactivation
cache_size=4000,
cache_deactivate_after=6000,)
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/synchronizers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ times in the life of a transaction. The tested behavior is new in ZODB 3.4.

First define a lightweight storage with a ``sync()`` method:

>>> import ZODB
>>> from ZODB.MappingStorage import MappingStorage
>>> import transaction

Expand All @@ -19,6 +18,7 @@ First define a lightweight storage with a ``sync()`` method:

Make a change locally:

>>> import ZODB
>>> st = SimpleStorage()
>>> db = ZODB.DB(st)
>>> cn = db.open()
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/testBroken.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def test_integration():
r"""Test the integration of broken object support with the databse:
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> db = DB(None)
We'll create a fake module with a class:
Expand Down
4 changes: 2 additions & 2 deletions src/ZODB/tests/testCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class CacheTestBase(utilTestCase):

def setUp(self):
from ZODB.DB import DB
from ZODB.db import DB
utilTestCase.setUp(self)
self.db = DB(None, cache_size = self.CACHE_SIZE)
self.conns = []
Expand Down Expand Up @@ -429,7 +429,7 @@ def testTwoObjsSameOid(self):
def test_basic_cache_size_estimation():
"""Make sure the basic accounting is correct:
>>> from ZODB.DB import DB
>>> from ZODB.db import DB
>>> db = DB(None)
>>> conn = db.open()
Expand Down
Loading

0 comments on commit 2b2cede

Please sign in to comment.