diff options
Diffstat (limited to 'test/features/environment.py')
-rw-r--r-- | test/features/environment.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/features/environment.py b/test/features/environment.py index 1a49dbe..98c2004 100644 --- a/test/features/environment.py +++ b/test/features/environment.py @@ -16,8 +16,9 @@ def before_all(context): os.environ['LINES'] = "100" os.environ['COLUMNS'] = "100" os.environ['EDITOR'] = 'ex' - os.environ['LC_ALL'] = 'en_US.utf8' + os.environ['LC_ALL'] = 'en_US.UTF-8' os.environ['PROMPT_TOOLKIT_NO_CPR'] = '1' + os.environ['MYCLI_HISTFILE'] = os.devnull test_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) login_path_file = os.path.join(test_dir, 'mylogin.cnf') @@ -42,6 +43,10 @@ def before_all(context): 'my_test_host', os.getenv('PYTEST_HOST', 'localhost') ), + 'port': context.config.userdata.get( + 'my_test_port', + int(os.getenv('PYTEST_PORT', '3306')) + ), 'user': context.config.userdata.get( 'my_test_user', os.getenv('PYTEST_USER', 'root') @@ -72,7 +77,8 @@ def before_all(context): context.conf['myclirc'] = os.path.join(context.package_root, 'test', 'myclirc') - context.cn = dbutils.create_db(context.conf['host'], context.conf['user'], + context.cn = dbutils.create_db(context.conf['host'], context.conf['port'], + context.conf['user'], context.conf['pass'], context.conf['dbname']) @@ -82,8 +88,9 @@ def before_all(context): def after_all(context): """Unset env parameters.""" dbutils.close_cn(context.cn) - dbutils.drop_db(context.conf['host'], context.conf['user'], - context.conf['pass'], context.conf['dbname']) + dbutils.drop_db(context.conf['host'], context.conf['port'], + context.conf['user'], context.conf['pass'], + context.conf['dbname']) # Restore env vars. #for k, v in context.pgenv.items(): @@ -118,11 +125,12 @@ def after_scenario(context, _): host = context.conf['host'] dbname = context.currentdb context.cli.expect_exact( - '{0}@{1}:{2}> '.format( + '{0}@{1}:{2}>'.format( user, host, dbname ), timeout=5 ) + context.cli.sendcontrol('c') context.cli.sendcontrol('d') context.cli.expect_exact(pexpect.EOF, timeout=5) |