File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
2
3
3
from testcontainers .compose import DockerCompose
4
+ from testcontainers .core .docker_client import DockerClient
4
5
from testcontainers .core .exceptions import NoSuchPortExposed
5
- from testcontainers .core .utils import inside_container
6
6
7
7
8
8
def test_can_spawn_service_via_compose ():
@@ -29,5 +29,5 @@ def test_can_throw_exception_if_no_port_exposed():
29
29
30
30
def test_compose_wait_for_container_ready ():
31
31
with DockerCompose ("tests" ) as compose :
32
- host = "host.docker.internal" if inside_container () else "localhost"
33
- compose .wait_for ("http://%s:4444/wd/hub" % host )
32
+ docker = DockerClient ()
33
+ compose .wait_for ("http://%s:4444/wd/hub" % docker . host () )
Original file line number Diff line number Diff line change @@ -31,10 +31,8 @@ def test_docker_env_variables():
31
31
db .with_bind_ports (3306 , 32785 )
32
32
with db :
33
33
url = db .get_connection_url ()
34
- if inside_container ():
35
- assert re .match (r'mysql\+pymysql://demo:test@(\d+\.){3}\d+:3306/custom_db' , url )
36
- else :
37
- assert url == 'mysql+pymysql://demo:test@localhost:32785/custom_db'
34
+ pattern = r'mysql\+pymysql:\/\/demo:test@[\w,.]+:(3306|32785)\/custom_db'
35
+ assert re .match (pattern , url )
38
36
39
37
40
38
def test_docker_kargs ():
You can’t perform that action at this time.
0 commit comments