testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.53k stars 280 forks source link

fix(core): Improving typing for common container usage scenarios #523

Closed santi closed 5 months ago

santi commented 5 months ago

Improves type hints for type checking in a common use cases:

with MySqlContainer("mysql:8").with_env("some", "value") as mysql:
    url = mysql.get_connection_url()  # get_connection_url would previously be an unknown member here

And, also improved type hinting for the custom DockerClient's run command, where the linter no longer reports an error due to missing parameter types:

DockerClient.run("nginx")  # Previously this would report "Argument missing for parameter "image"
alexanderankin commented 5 months ago

linking #504 and #305