Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for FF_DB_HOST env variable for tests

  • Loading branch information...
commit 3c1e4a861549054df359fe7db9ffaab437900f5c 1 parent 1ad0eb2
@jgmize jgmize authored
Showing with 8 additions and 0 deletions.
  1. +3 −0  README.rst
  2. +5 −0 tests/__init__.py
View
3  README.rst
@@ -60,6 +60,9 @@ Here are some environment variables that are acknowledged by the test suite:
**FF_DB_NAME**
MySQL db name for manage.py test. Defaults to ``_funfactory_test``.
+**FF_DB_HOST**
+ MySQL db host for manage.py test. Defaults to an empty string.
+
**FF_PLAYDOH_REMOTE**
Git qualified URL for playdoh repo. Defaults to ``git://github.com/mozilla/playdoh.git``.
View
5 tests/__init__.py
@@ -16,6 +16,7 @@
shell = partial(check_call, shell=True)
DB_USER = os.environ.get('FF_DB_USER', 'root')
DB_PASS = os.environ.get('FF_DB_PASS', '')
+DB_HOST = os.environ.get('FF_DB_HOST', '')
DB_NAME = os.environ.get('FF_DB_NAME', '_funfactory_test')
FF_PLAYDOH_REMOTE = os.environ.get('FF_PLAYDOH_REMOTE',
'git://github.com/mozilla/playdoh.git')
@@ -87,6 +88,8 @@ def begin(self):
"'USER': '%s'" % DB_USER)
new_st = new_st.replace("'PASSWORD': ''",
"'PASSWORD': '%s'" % DB_PASS)
+ new_st = new_st.replace("'HOST': ''",
+ "'HOST': '%s'" % DB_HOST)
new_st = new_st.replace("'NAME': 'playdoh_app'",
"'NAME': '%s'" % DB_NAME)
new_st = new_st.replace("SECRET_KEY = ''",
@@ -100,6 +103,8 @@ def begin(self):
extra = ''
if DB_PASS:
extra = '--password=%s' % DB_PASS
+ if DB_HOST:
+ extra += ' -h %s' % DB_HOST
shell('mysql -u %s %s -e "create database if not exists %s"'
% (DB_USER, extra, DB_NAME))
check_call([sys.executable, 'manage.py', 'syncdb', '--noinput'],
Please sign in to comment.
Something went wrong with that request. Please try again.