relstorage/relstorage/tests/util.py

40 lines
1.0 KiB
Python

import os
import unittest
# ZODB >= 3.9. The blob directory can be a private cache.
shared_blob_dir_choices = (False, True)
support_blob_cache = True
RUNNING_ON_TRAVIS = os.environ.get('TRAVIS')
RUNNING_ON_APPVEYOR = os.environ.get('APPVEYOR')
RUNNING_ON_CI = RUNNING_ON_TRAVIS or RUNNING_ON_APPVEYOR
if RUNNING_ON_CI:
skipOnCI = unittest.skip
else:
def skipOnCI(reason): # pylint:disable=unused-argument
def dec(f):
return f
return dec
CACHE_SERVERS = None
CACHE_MODULE_NAME = None
if RUNNING_ON_TRAVIS:
# We expect to have access to a local memcache server
# on travis. Use it if we can import drivers.
# pylint:disable=unused-import
try:
import pylibmc
CACHE_SERVERS = ["localhost:11211"]
CACHE_MODULE_NAME = 'relstorage.pylibmc_wrapper'
except ImportError:
try:
import memcache
CACHE_SERVERS = ["localhost:11211"]
CACHE_MODULE_NAME = 'memcache'
except ImportError:
pass