Skip to content

Commit 0ab7feb

Browse files
committed
Switch to mysqld --initialize as mysql_install_db is deprecated
1 parent 985a760 commit 0ab7feb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pytest_services/mysql.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ def mysql_system_database(
4747
):
4848
"""Install database to given path."""
4949
if run_services:
50-
mysql_install_db = find_executable('mysql_install_db')
51-
assert mysql_install_db, 'You have to install mysql_install_db script.'
50+
mysqld = find_executable('mysqld')
51+
assert mysqld, 'You have to install mysqld script.'
5252

5353
try:
54-
services_log.debug('Starting mysql_install_db.')
54+
services_log.debug('Starting mysqld.')
5555
check_output([
56-
mysql_install_db,
56+
mysqld,
57+
'--initialize',
5758
'--defaults-file={0}'.format(mysql_defaults_file),
5859
'--datadir={0}'.format(mysql_data_dir),
5960
'--basedir={0}'.format(mysql_base_dir),
@@ -65,7 +66,7 @@ def mysql_system_database(
6566
'Please ensure you disabled apparmor for /run/shm/** or for whole mysql'.format(e=e))
6667
raise
6768
finally:
68-
services_log.debug('mysql_install_db was executed.')
69+
services_log.debug('mysqld was executed.')
6970

7071

7172
@pytest.fixture(scope='session')

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ envlist=
99
skip_missing_interpreters = true
1010

1111
[testenv]
12-
commands= py.test tests --junitxml={envlogdir}/junit-{envname}.xml
12+
commands= py.test tests --junitxml={envlogdir}/junit-{envname}.xml {posargs}
1313
deps =
1414
pytestlatest: pytest
1515
pytest310: pytest~=3.10.0

0 commit comments

Comments
 (0)