summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/conftest.py6
-rw-r--r--test/test_main.py8
-rw-r--r--test/test_sqlexecute.py2
-rw-r--r--test/utils.py4
4 files changed, 13 insertions, 7 deletions
diff --git a/test/conftest.py b/test/conftest.py
index d7d10ce..1325596 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -6,8 +6,8 @@ import mycli.sqlexecute
@pytest.fixture(scope="function")
def connection():
- create_db('_test_db')
- connection = db_connection('_test_db')
+ create_db('mycli_test_db')
+ connection = db_connection('mycli_test_db')
yield connection
connection.close()
@@ -22,7 +22,7 @@ def cursor(connection):
@pytest.fixture
def executor(connection):
return mycli.sqlexecute.SQLExecute(
- database='_test_db', user=USER,
+ database='mycli_test_db', user=USER,
host=HOST, password=PASSWORD, port=PORT, socket=None, charset=CHARSET,
local_infile=False, ssl=None, ssh_user=SSH_USER, ssh_host=SSH_HOST,
ssh_port=SSH_PORT, ssh_password=None, ssh_key_filename=None
diff --git a/test/test_main.py b/test/test_main.py
index 7731603..c3351ec 100644
--- a/test/test_main.py
+++ b/test/test_main.py
@@ -25,7 +25,7 @@ os.environ['MYSQL_TEST_LOGIN_FILE'] = login_path_file
CLI_ARGS = ['--user', USER, '--host', HOST, '--port', PORT,
'--password', PASSWORD, '--myclirc', default_config_file,
'--defaults-file', default_config_file,
- '_test_db']
+ 'mycli_test_db']
@dbtest
@@ -305,19 +305,25 @@ def test_dsn(monkeypatch):
# Setup classes to mock mycli.main.MyCli
class Formatter:
format_name = None
+
class Logger:
def debug(self, *args, **args_dict):
pass
+
def warning(self, *args, **args_dict):
pass
+
class MockMyCli:
config = {'alias_dsn': {}}
+
def __init__(self, **args):
self.logger = Logger()
self.destructive_warning = False
self.formatter = Formatter()
+
def connect(self, **args):
MockMyCli.connect_args = args
+
def run_query(self, query, new_line=True):
pass
diff --git a/test/test_sqlexecute.py b/test/test_sqlexecute.py
index 0f38a97..9c2bcb8 100644
--- a/test/test_sqlexecute.py
+++ b/test/test_sqlexecute.py
@@ -71,7 +71,7 @@ def test_table_and_columns_query(executor):
@dbtest
def test_database_list(executor):
databases = executor.databases()
- assert '_test_db' in databases
+ assert 'mycli_test_db' in databases
@dbtest
diff --git a/test/utils.py b/test/utils.py
index 66b4194..ab12248 100644
--- a/test/utils.py
+++ b/test/utils.py
@@ -41,8 +41,8 @@ dbtest = pytest.mark.skipif(
def create_db(dbname):
with db_connection().cursor() as cur:
try:
- cur.execute('''DROP DATABASE IF EXISTS _test_db''')
- cur.execute('''CREATE DATABASE _test_db''')
+ cur.execute('''DROP DATABASE IF EXISTS mycli_test_db''')
+ cur.execute('''CREATE DATABASE mycli_test_db''')
except:
pass