) parser.addoption( "--mysql-user", action="store", dest="mysql_user", help=_help_user ) parser.addoption( "--mysql-passwd", action="store", dest="mysql_passwd", help=_help_passwd ) parser.addoption( "--mysql-dbname", action="store", dest="mysql_dbname", help=_help_dbname ) parser.addoption( "--mysql-params", action="store", dest="mysql_params", help=_help_params ) parser.addoption( "--mysql-logsdir", action="store", metavar="path", dest="mysql_logsdir", help=_help_logsdir, ) mysql_proc = factories.mysql_proc() mysql_noproc = factories.mysql_noproc() mysql = factories.mysql("mysql_proc")
action='store', dest='mysql_passwd', help=_help_passwd ) parser.addoption( '--mysql-dbname', action='store', dest='mysql_dbname', help=_help_dbname ) parser.addoption( '--mysql-params', action='store', dest='mysql_params', help=_help_params ) parser.addoption( '--mysql-logsdir', action='store', metavar='path', dest='mysql_logsdir', help=_help_params ) mysql_proc = factories.mysql_proc() mysql = factories.mysql('mysql_proc')
import pytest # TODO: use relative path. import sys sys.path.append('/Users/lixuanqi/GitHub/NuaaOversea-backend-Flask') from pytest_mysql import factories from app import create_app mysql_my_proc = factories.mysql_proc(host='localhost', port=7777) mysql_my = factories.mysql('mysql_my_proc') @pytest.fixture def app(): app = create_app({ 'TESTING': True, 'SQLALCHEMY_DATABASE_URI': 'mysql+pymysql://root:@127.0.0.1:7777/test?charset=utf8' }) # with app.app_context(): # # init_db() # yield app # # os.close(db_fd) # os.unlink(db_path)
"""Tests main conftest file.""" import sys import warnings from pytest_mysql import factories if not sys.version_info >= (3, 5): warnings.simplefilter("error", category=DeprecationWarning) # pylint:disable=invalid-name mysql_proc2 = factories.mysql_proc(port=3308, params='--skip-sync-frm') mysql2 = factories.mysql('mysql_proc2') mysql_rand_proc = factories.mysql_proc(port=None, params='--skip-sync-frm') mysql_rand = factories.mysql('mysql_rand_proc') # pylint:enable=invalid-name
"""Tests main conftest file.""" import sys import warnings from pytest_mysql import factories if not sys.version_info >= (3, 5): warnings.simplefilter("error", category=DeprecationWarning) # pylint:disable=invalid-name mysql_proc2 = factories.mysql_proc(port=3308) mysql2 = factories.mysql("mysql_proc2", dbname="test-db") mysql_rand_proc = factories.mysql_proc(port=None) mysql_rand = factories.mysql("mysql_rand_proc") # pylint:enable=invalid-name