11"""Fixtures for mysql."""
22import os
33import shutil
4+ from textwrap import dedent
45
5- from shutil import which
66import pytest
77
88from .process import (
@@ -16,22 +16,28 @@ def mysql_defaults_file(
1616 run_services , tmp_path_factory , memory_temp_dir , request ):
1717 """MySQL defaults file."""
1818 if run_services :
19- cfg = tmp_path_factory .mktemp (request . session . name )
19+ cfg = tmp_path_factory .mktemp ("pytest-services" )
2020 defaults_path = str (cfg / 'defaults.cnf' )
2121
2222 with open (defaults_path , 'w+' ) as fd :
23- fd .write ("""
24- [mysqld]
25- user = {user}
26- tmpdir = {tmpdir}
27- default-time-zone = SYSTEM
28- """ .format (user = os .environ ['USER' ], tmpdir = memory_temp_dir ))
23+ user = os .environ ["USER" ]
24+ fd .write (
25+ dedent (
26+ f"""
27+ [mysqld]
28+ user = { user }
29+ tmpdir = { memory_temp_dir }
30+ default-time-zone = SYSTEM
31+ """
32+ )
33+ )
2934 return defaults_path
35+ return None
3036
3137
3238@pytest .fixture (scope = 'session' )
3339def mysql_base_dir ():
34- my_print_defaults = which ('my_print_defaults' )
40+ my_print_defaults = shutil . which ('my_print_defaults' )
3541 assert my_print_defaults , 'You have to install my_print_defaults script.'
3642
3743 return os .path .dirname (os .path .dirname (os .path .realpath (my_print_defaults )))
@@ -49,7 +55,8 @@ def mysql_system_database(
4955):
5056 """Install database to given path."""
5157 if run_services :
52- mysqld = which ('mysqld' )
58+ pytest .skip (reason = "#50 needs investigation" )
59+ mysqld = shutil .which ('mysqld' )
5360 assert mysqld , 'You have to install mysqld script.'
5461
5562 try :
0 commit comments