Moving test sys.path/env setup
This commit is contained in:
parent
fbeb83fa43
commit
9117fd408c
@ -0,0 +1,22 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
def setup_sys_path():
|
||||
sys.path = [os.path.abspath(os.path.dirname('stacktach'))] + sys.path
|
||||
|
||||
|
||||
def setup_environment():
|
||||
'''Other than the settings module, these config settings just need
|
||||
to have values. The are used when the settings module is loaded
|
||||
and then never again.'''
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
||||
os.environ['STACKTACH_DB_ENGINE'] = ''
|
||||
os.environ['STACKTACH_DB_NAME'] = ''
|
||||
os.environ['STACKTACH_DB_HOST'] = ''
|
||||
os.environ['STACKTACH_DB_USERNAME'] = ''
|
||||
os.environ['STACKTACH_DB_PASSWORD'] = ''
|
||||
os.environ['STACKTACH_INSTALL_DIR'] = ''
|
||||
|
||||
|
||||
setup_sys_path()
|
||||
setup_environment()
|
@ -2,7 +2,6 @@ import datetime
|
||||
import decimal
|
||||
import unittest
|
||||
|
||||
import utils
|
||||
from stacktach import datetime_to_decimal
|
||||
|
||||
class DatetimeToDecimalTestCase(unittest.TestCase):
|
||||
|
@ -5,22 +5,6 @@ import unittest
|
||||
|
||||
TENANT_ID_1 = 'testtenantid1'
|
||||
|
||||
def setup_sys_path():
|
||||
sys.path = [os.path.abspath(os.path.dirname('stacktach'))] + sys.path
|
||||
|
||||
def setup_environment():
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
||||
os.environ['STACKTACH_DB_ENGINE'] = 'django.db.backends.sqlite3'
|
||||
when = str(datetime.datetime.utcnow())
|
||||
os.environ['STACKTACH_DB_NAME'] = '/tmp/stacktach.%s.sqlite' % when
|
||||
os.environ['STACKTACH_DB_HOST'] = ''
|
||||
os.environ['STACKTACH_DB_USERNAME'] = ''
|
||||
os.environ['STACKTACH_DB_PASSWORD'] = ''
|
||||
install_dir = os.path.abspath(os.path.dirname('stacktach'))
|
||||
os.environ['STACKTACH_INSTALL_DIR'] = install_dir
|
||||
|
||||
setup_sys_path()
|
||||
setup_environment()
|
||||
from stacktach import datetime_to_decimal as dt
|
||||
|
||||
INSTANCE_ID_1 = 'testinstanceid1'
|
||||
|
Loading…
x
Reference in New Issue
Block a user