testcontainers
توضیحات
Python library for throwaway instances of anything that can run in a Docker container
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Unix |
| نام فایل | testcontainers-4.9.2 |
| نام | testcontainers |
| نسخه کتابخانه | 4.9.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | ['Balint Bartha <totallyzen@users.noreply.github.com>, David Ankin <daveankin@gmail.com>, Vemund Santi <vemund@santi.no>'] |
| نویسنده | - |
| ایمیل نویسنده | Sergey Pirogov <automationremarks@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/testcontainers/ |
| مجوز | - |
[](https://github.com/astral-sh/uv)
[](https://github.com/astral-sh/ruff)

[](https://github.com/testcontainers/testcontainers-python/blob/main/LICENSE)
[](https://pypi.python.org/pypi/testcontainers)
[](https://codecov.io/gh/testcontainers/testcontainers-python)


[](http://testcontainers-python.readthedocs.io/en/latest/?badge=latest)
[](https://codespaces.new/testcontainers/testcontainers-python)
# Testcontainers Python
`testcontainers-python` facilitates the use of Docker containers for functional and integration testing.
For more information, see [the docs][readthedocs].
[readthedocs]: https://testcontainers-python.readthedocs.io/en/latest/
## Getting Started
```pycon
>>> from testcontainers.postgres import PostgresContainer
>>> import sqlalchemy
>>> with PostgresContainer("postgres:16") as postgres:
... engine = sqlalchemy.create_engine(postgres.get_connection_url())
... with engine.begin() as connection:
... result = connection.execute(sqlalchemy.text("select version()"))
... version, = result.fetchone()
>>> version
'PostgreSQL 16...'
```
The snippet above will spin up a postgres database in a container. The `get_connection_url()` convenience method returns a `sqlalchemy` compatible url we use to connect to the database and retrieve the database version.
## Contributing / Development / Release
See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more details.
## Configuration
You can set environment variables to configure the library behaviour:
| Env Variable | Example | Description |
| --------------------------------------- | --------------------------- | ---------------------------------------------------------------------------------- |
| `TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE` | `/var/run/docker.sock` | Path to Docker's socket used by ryuk |
| `TESTCONTAINERS_RYUK_PRIVILEGED` | `false` | Run ryuk as a privileged container |
| `TESTCONTAINERS_RYUK_DISABLED` | `false` | Disable ryuk |
| `RYUK_CONTAINER_IMAGE` | `testcontainers/ryuk:0.8.1` | Custom image for ryuk |
| `RYUK_RECONNECTION_TIMEOUT` | `10s` | Reconnection timeout for Ryuk TCP socket before Ryuk reaps all dangling containers |
Alternatively you can set the configuration during runtime:
```python
from testcontainers.core import testcontainers_config
testcontainers_config.ryuk_docker_socket = "/home/user/docker.sock"
```
نیازمندی
| مقدار | نام |
|---|---|
| - | docker |
| - | python-dotenv |
| - | typing-extensions |
| - | urllib3 |
| - | wrapt |
| xtr | python-arango>=8; |
| xtr | boto3>=1; |
| xtr | httpx; |
| xtr | azure-storage-blob>=12; |
| xtr | chromadb-client>=1; |
| xtr | clickhouse-driver; |
| xtr | azure-cosmos>=4; |
| xtr | httpx; |
| xtr | sqlalchemy-cratedb; |
| platform_machin | ibm-db-sa; |
| xtr | sqlalchemy; |
| xtr | httpx; |
| xtr | redis>=7; |
| xtr | sqlalchemy; |
| xtr | google-cloud-datastore>=2; |
| xtr | google-cloud-pubsub>=2; |
| xtr | influxdb-client>=1; |
| xtr | influxdb>=5; |
| xtr | kubernetes; |
| xtr | pyyaml>=6.0.3; |
| ython_versio | python-keycloak>=6; |
| xtr | boto3>=1; |
| xtr | cryptography; |
| xtr | minio>=7; |
| xtr | pymongo>=4; |
| xtr | pymssql>=2; |
| xtr | sqlalchemy; |
| xtr | pymysql[rsa]>=1; |
| xtr | sqlalchemy; |
| xtr | nats-py>=2; |
| xtr | neo4j>=6; |
| xtr | openfga-sdk; |
| ython_versio | opensearch-py>=3; |
| xtr | oracledb>=3; |
| xtr | sqlalchemy; |
| xtr | oracledb>=3; |
| xtr | sqlalchemy; |
| xtr | qdrant-client>=1; |
| xtr | pika>=1; |
| xtr | redis>=7; |
| xtr | bcrypt>=5; |
| ython_versio | cassandra-driver>=3; |
| xtr | selenium>=4; |
| xtr | cryptography; |
| xtr | httpx; |
| xtr | trino; |
| xtr | weaviate-client>=4; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.10 | Python |
نحوه نصب
نصب پکیج whl testcontainers-4.9.2:
pip install testcontainers.whl
نصب پکیج tar.gz testcontainers-4.9.2:
pip install testcontainers.tar.gz