@@ -34,22 +34,27 @@ def pytest_generate_tests(metafunc):
34
34
if 'loop_type' in metafunc .fixturenames :
35
35
loop_type = ['asyncio' , 'uvloop' ] if uvloop else ['asyncio' ]
36
36
metafunc .parametrize ("loop_type" , loop_type )
37
-
38
- if 'mysql_tag' in metafunc .fixturenames :
39
- tags = set (metafunc .config .option .mysql_tag )
40
- if not tags :
41
- tags = ['5.6' , '8.0' ]
42
- elif 'all' in tags :
43
- tags = ['5.6' , '5.7' , '8.0' ]
44
- else :
45
- tags = list (tags )
46
- metafunc .parametrize ("mysql_tag" , tags , scope = 'session' )
37
+ #
38
+ # if 'mysql_tag' in metafunc.fixturenames:
39
+ # tags = set(metafunc.config.option.mysql_tag)
40
+ # if not tags:
41
+ # tags = ['5.6', '8.0']
42
+ # elif 'all' in tags:
43
+ # tags = ['5.6', '5.7', '8.0']
44
+ # else:
45
+ # tags = list(tags)
46
+ # metafunc.parametrize("mysql_tag", tags, scope='session')
47
47
48
48
49
49
# This is here unless someone fixes the generate_tests bit
50
50
@pytest .yield_fixture (scope = 'session' )
51
51
def mysql_tag ():
52
- return '5.6'
52
+ return os .environ .get ('DBTAG' , '10.5' )
53
+
54
+
55
+ @pytest .yield_fixture (scope = 'session' )
56
+ def mysql_image ():
57
+ return os .environ .get ('DB' , 'mariadb' )
53
58
54
59
55
60
@pytest .yield_fixture
@@ -119,12 +124,10 @@ def pytest_addoption(parser):
119
124
120
125
121
126
@pytest .fixture
122
- def mysql_params ():
123
- params = {"host" : os .environ .get ('MYSQL_HOST' , 'localhost' ),
124
- "port" : int (os .environ .get ('MYSQL_PORT' , 3306 )),
125
- "user" : os .environ .get ('MYSQL_USER' , 'root' ),
127
+ def mysql_params (mysql_server ):
128
+ params = {** mysql_server ['conn_params' ],
126
129
"db" : os .environ .get ('MYSQL_DB' , 'test_pymysql' ),
127
- "password" : os .environ .get ('MYSQL_PASSWORD' , '' ),
130
+ # "password": os.environ.get('MYSQL_PASSWORD', ''),
128
131
"local_infile" : True ,
129
132
"use_unicode" : True ,
130
133
}
@@ -227,11 +230,11 @@ def ensure_mysql_verison(request, mysql_tag):
227
230
228
231
229
232
@pytest .fixture (scope = 'session' )
230
- def mysql_server (unused_port , docker , session_id , mysql_tag , request ):
233
+ def mysql_server (unused_port , docker , session_id , mysql_image , mysql_tag , request ):
231
234
print ('\n STARTUP CONTAINER - {0}\n ' .format (mysql_tag ))
232
235
233
236
if not request .config .option .no_pull :
234
- docker .pull ('mysql :{}' .format (mysql_tag ))
237
+ docker .pull ('{} :{}' .format (mysql_image , mysql_tag ))
235
238
236
239
# bound IPs do not work on OSX
237
240
host = "127.0.0.1"
0 commit comments