diff options
author | Iryna Cherniavska <i.chernyavska@gmail.com> | 2015-07-31 09:43:58 -0700 |
---|---|---|
committer | Iryna Cherniavska <i.chernyavska@gmail.com> | 2015-07-31 09:43:58 -0700 |
commit | 59af55c90bf30719888164627a8e619a6b9c3b34 (patch) | |
tree | 046788def9bb2dfe1008fac547157ca87fc3729d | |
parent | ae2e56f3192589c43ea1635aab5c156c2391d364 (diff) |
Added python version suffix to test db name, so each version creates its own test db.
-rw-r--r-- | tests/features/environment.py | 8 | ||||
-rw-r--r-- | tests/features/steps/step_definitions.py | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/tests/features/environment.py b/tests/features/environment.py index 03b597ea..d887115d 100644 --- a/tests/features/environment.py +++ b/tests/features/environment.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from __future__ import print_function import os +import sys import pexpect import db_utils as dbutils import fixture_utils as fixutils @@ -18,12 +19,17 @@ def before_all(context): context.exit_sent = False + vi = sys.version_info + db_name = context.config.userdata.get('pg_test_db', None) + db_name_full = '{0}_{1}_{2}_{3}'.format( + db_name, vi.major, vi.minor, vi.micro) + # Store get params from config. context.conf = { 'host': context.config.userdata.get('pg_test_host', 'localhost'), 'user': context.config.userdata.get('pg_test_user', 'postgres'), 'pass': context.config.userdata.get('pg_test_pass', None), - 'dbname': context.config.userdata.get('pg_test_db', None), + 'dbname': db_name_full, } # Store old env vars. diff --git a/tests/features/steps/step_definitions.py b/tests/features/steps/step_definitions.py index b6fa69b8..cb2bd8c0 100644 --- a/tests/features/steps/step_definitions.py +++ b/tests/features/steps/step_definitions.py @@ -126,7 +126,7 @@ def step_db_connect_test(context): """ Send connect to database. """ - db_name = context.config.userdata.get('pg_test_db', None) + db_name = context.conf['dbname'] context.cli.sendline('\connect {0}'.format(db_name)) |