[Zodb-checkins] CVS: Zope3/src/zodb/tests - util.py:1.1

Jim Fulton jim at zope.com
Tue Jan 6 14:50:43 EST 2004


Update of /cvs-repository/Zope3/src/zodb/tests
In directory cvs.zope.org:/tmp/cvs-serv13659/src/zodb/tests

Added Files:
	util.py 
Log Message:
Added a utility module to make test code a little simpler.


=== Added File Zope3/src/zodb/tests/util.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Conventience function for creating test databases

$Id: util.py,v 1.1 2004/01/06 19:50:42 jim Exp $
"""

import time
from zodb.storage.memory import MemoryFullStorage
from zodb.db import DB as _DB
from transaction import get_transaction

def DB(name='Test'):
    return _DB(MemoryFullStorage(name))

def commit():
    get_transaction().commit()

def pack(db):
    db.pack(time.time()+1)




More information about the Zodb-checkins mailing list