You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python port for testcontainers-java that allows using docker containers for functional and integration testing. Testcontainers-python provides capabilities to spin up docker containers (such as a database, Selenium web browser, or any other container) for testing.
12
-
13
-
Currently available features:
14
-
15
-
* Generic docker container
16
-
* ArangoDB container
17
-
* Azurite container
18
-
* ClickHouse container
19
-
* ElasticSearch container
20
-
* Kafka container
21
-
* Keycloak container
22
-
* LocalStack container
23
-
* MariaDb container
24
-
* Microsoft SQL Server container
25
-
* Minio container
26
-
* MongoDB container
27
-
* MySql Db container
28
-
* Neo4j container
29
-
* NGINX container
30
-
* OpenSearch container
31
-
* OracleDb container
32
-
* PostgreSQL Db container
33
-
* RabbitMQ container
34
-
* Redis container
35
-
* Selenium Grid container
36
-
* Selenium Standalone container
11
+
testcontainers-python facilitates the use of Docker containers for functional and integration testing. The collection of packages currently supports the following features.
37
12
38
-
Installation
39
-
------------
40
-
41
-
The testcontainers package is available from `PyPI <https://pypi.org/project/testcontainers/>`_, and it can be installed using :code:`pip`. Depending on which containers are needed, you can specify additional dependencies as `extras <https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies>`_:
42
-
43
-
.. code-block:: bash
13
+
.. toctree::
44
14
45
-
# Install without extras
46
-
pip install testcontainers
47
-
# Install with one or more extras
48
-
pip install testcontainers[mysql]
49
-
pip install testcontainers[mysql,oracle]
15
+
core/README
16
+
arangodb/README
17
+
azurite/README
18
+
clickhouse/README
19
+
compose/README
20
+
elasticsearch/README
21
+
google/README
22
+
kafka/README
23
+
keycloak/README
24
+
localstack/README
25
+
minio/README
26
+
mongodb/README
27
+
mssql/README
28
+
mysql/README
29
+
neo4j/README
30
+
nginx/README
31
+
opensearch/README
32
+
oracle/README
33
+
postgres/README
34
+
rabbitmq/README
35
+
redis/README
36
+
selenium/README
50
37
51
38
Basic usage
52
39
-----------
@@ -64,9 +51,15 @@ Basic usage
64
51
>>> version
65
52
'PostgreSQL 9.5...'
66
53
67
-
The snippet above will spin up a Postgres database in a container. The :code:`get_connection_url()` convenience method returns a :code:`sqlalchemy` compatible url we use to connect to the database and retrieve the database version.
54
+
The snippet above will spin up a postgres database in a container. The :code:`get_connection_url()` convenience method returns a :code:`sqlalchemy` compatible url we use to connect to the database and retrieve the database version. More extensive documentation can be found at `Read The Docs <http://testcontainers-python.readthedocs.io/>`_.
55
+
56
+
Installation
57
+
------------
58
+
59
+
The suite of testcontainers packages is available on `PyPI <https://pypi.org/project/testcontainers/>`_, and individual packages can be installed using :code:`pip`. We recommend installing the package you need by running :code:`pip install testcontainers-<feature>`, e.g., :code:`pip install testcontainers-mysql`.
60
+
61
+
For backwards compatibility, packages can also be installed by specifying `extras <https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies>`_, e.g., :code:`pip install testcontainers[mysql]`.
68
62
69
-
More extensive documentation can be found at `Read The Docs <http://testcontainers-python.readthedocs.io/>`_.
70
63
71
64
Usage within Docker (e.g., in a CI)
72
65
-----------------------------------
@@ -76,7 +69,6 @@ When trying to launch a testcontainer from within a Docker container two things
76
69
1. The container has to provide a docker client installation. Either use an image that has docker pre-installed (e.g. the `official docker images <https://hub.docker.com/_/docker>`_) or install the client from within the `Dockerfile` specification.
77
70
2. The container has to have access to the docker daemon which can be achieved by mounting `/var/run/docker.sock` or setting the `DOCKER_HOST` environment variable as part of your `docker run` command.
78
71
79
-
80
72
Setting up a development environment
81
73
------------------------------------
82
74
@@ -100,28 +92,3 @@ You can contribute a new container in three steps:
100
92
1. Create a new module at :code:`testcontainers/[my fancy container].py` that implements the new functionality.
101
93
2. Create a new test module at :code:`tests/test_[my fancy container].py` that tests the new functionality.
102
94
3. Add :code:`[my fancy container]` to the list of test components in the GitHub Action configuration at :code:`.github/workflows/main.yml`.
0 commit comments