File tree 4 files changed +7
-8
lines changed
4 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 38
38
}
39
39
40
40
postgres_container = {
41
- "image" : "postgres:latest" ,
42
41
"env" : {
43
42
"POSTGRES_USER" : postgres_db ["user" ],
44
43
"POSTGRES_PASSWORD" : postgres_db ["passwd" ],
Original file line number Diff line number Diff line change 6
6
7
7
8
8
class MySqlDockerContainer (DockerContainer ):
9
- def __init__ (self , image = 'mysql:latest ' ):
10
- super (DockerContainer , self ).__init__ ()
11
- self .image = image
9
+ def __init__ (self , version = 'latest' , image = 'mysql' ):
10
+ super (self . __class__ , self ).__init__ ()
11
+ self .image = "{}:{}" . format ( image , version )
12
12
13
13
def start (self ):
14
14
"""
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ def start(self):
12
12
13
13
@wait_container_is_ready ()
14
14
def connection (self ):
15
- return psycopg2 .connect (** config .postgres_db )
15
+ return psycopg2 .connect (self . image , ** config .postgres_db )
16
16
17
- def __init__ (self , image = "postgres:latest " ):
17
+ def __init__ (self , version = 'latest' , image = "postgres" ):
18
18
super (DockerContainer , self ).__init__ ()
19
- config . postgres_container [ " image" ] = image
19
+ self . image = "{}:{}" . format ( image , version )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def test_docker_run_selenium():
15
15
16
16
17
17
def test_docker_run_mysql ():
18
- with MySqlDockerContainer () as mysql :
18
+ with MySqlDockerContainer ('5.5' ) as mysql :
19
19
conn = mysql .connection ()
20
20
cur = conn .cursor ()
21
21
You can’t perform that action at this time.
0 commit comments