Commit 04a5c63c authored by Andreas Jung's avatar Andreas Jung

Testing/custom_zodb.py: added support use a different storage other

than DemoStorage. A dedicated FileStorage can be mount by setting the
$TEST_FILESTORAGE environment variable to a custom Data.fs file.  A 
ZEO server can be configured using the $TEST_ZEO_HOST and 
$TEST_ZEO_PORT environment variables. This new functionality allows us
to use the standard Zope testrunner for writing and running tests
against existing Zope installations.
parent 088a5e5a
......@@ -69,6 +69,14 @@ Zope Changes
Features added
- Testing/custom_zodb.py: added support use a different storage other
than DemoStorage. A dedicated FileStorage can be mount by setting the
$TEST_FILESTORAGE environment variable to a custom Data.fs file. A
ZEO server can be configured using the $TEST_ZEO_HOST and
$TEST_ZEO_PORT environment variables. This new functionality allows us
to use the standard Zope testrunner for writing and running tests
against existing Zope installations.
- The ZPublisher HTTP request has now both the debug and locale
attributes available, like its Zope 3 counterpart. The debug attribute
was so far limited to code from the zope.* namespace in order to make
......
import os
import logging
import ZODB
from ZODB.DemoStorage import DemoStorage
Storage = DemoStorage(quota=(1<<20))
LOG = logging.getLogger('Testing')
def getStorage():
get = os.environ.get
# Support for running tests against an existing ZEO storage
# ATT: better configuration options (ajung, 17.09.2007)
if os.environ.has_key('TEST_ZEO_HOST') and os.environ.has_key('TEST_ZEO_PORT'):
from ZEO.ClientStorage import ClientStorage
zeo_host = get('TEST_ZEO_HOST')
zeo_port = int(get('TEST_ZEO_PORT'))
LOG.info('Using ZEO server (%s:%d)' % (zeo_host, zeo_port))
return ClientStorage((zeo_host, zeo_port))
elif os.environ.has_key('TEST_FILESTORAGE'):
import ZODB.FileStorage
datafs = get('TEST_FILESTORAGE')
LOG.info('Using Filestorage at (%s)' % datafs)
return ZODB.FileStorage.FileStorage(datafs)
else:
from ZODB.DemoStorage import DemoStorage
Storage = DemoStorage(quota=(1<<20))
LOG.info('Using DemoStorage')
return DemoStorage(quota=(1<<20))
Storage = getStorage()
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