mirror of
https://github.com/datafolklabs/cement.git
synced 2026-02-06 13:42:03 +00:00
Support Environment Variable Overrides for Tests
This commit is contained in:
parent
9a7ef19419
commit
bd23b42ccf
@ -1,10 +1,15 @@
|
||||
"""Tests for cement.ext.ext_redis."""
|
||||
|
||||
import os
|
||||
from time import sleep
|
||||
from random import random
|
||||
from cement.utils import test
|
||||
from cement.utils.misc import init_defaults
|
||||
|
||||
if 'REDIS_HOST' in os.environ.keys():
|
||||
redis_host = os.environ['REDIS_HOST']
|
||||
else:
|
||||
redis_host = 'redis'
|
||||
|
||||
class RedisExtTestCase(test.CementTestCase):
|
||||
|
||||
@ -12,7 +17,7 @@ class RedisExtTestCase(test.CementTestCase):
|
||||
super(RedisExtTestCase, self).setUp()
|
||||
self.key = "cement-tests-random-key-%s" % random()
|
||||
defaults = init_defaults('tests', 'cache.redis')
|
||||
defaults['cache.redis']['host'] = '127.0.0.1'
|
||||
defaults['cache.redis']['host'] = redis_host
|
||||
defaults['cache.redis']['port'] = 6379
|
||||
defaults['cache.redis']['db'] = 0
|
||||
self.app = self.make_app('tests',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user