### Clone and setup development environment Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Initializes the project repository and installs dependencies using uv. ```bash git clone https://github.com/WoodyWoodster/django-testcontainers-plus cd django-testcontainers-plus uv sync --all-extras --dev ``` -------------------------------- ### Install all extras in CI Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/installation.md Recommended installation command for CI environments to ensure all providers are supported. ```bash pip install django-testcontainers-plus[all] ``` -------------------------------- ### Install MySQL provider Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/mysql.md Install the necessary package extra to enable MySQL support. ```bash pip install django-testcontainers-plus[mysql] ``` -------------------------------- ### Install package via CLI Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/installation.md Standard installation commands for the package using package managers. ```bash uv add django-testcontainers-plus # or pip install django-testcontainers-plus ``` ```bash uv add django-testcontainers-plus ``` ```bash pip install django-testcontainers-plus ``` -------------------------------- ### Build documentation locally Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Installs documentation dependencies and builds the site using mkdocs. ```bash uv sync --extra docs uv run mkdocs build ``` -------------------------------- ### Install Django Testcontainers Plus Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/index.md Install the package via pip. ```bash pip install django-testcontainers-plus ``` -------------------------------- ### Install optional provider extras Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/installation.md Install specific client libraries required for non-PostgreSQL providers. ```bash pip install django-testcontainers-plus[mysql] ``` ```bash pip install django-testcontainers-plus[redis] ``` ```bash pip install django-testcontainers-plus[all] ``` -------------------------------- ### Install MySQL dependencies Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/troubleshooting.md Commands to install MySQL support for the package. ```bash pip install django-testcontainers-plus[mysql] ``` ```bash pip install django-testcontainers-plus[all] ``` -------------------------------- ### Install Optional Extras Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Install specific dependencies for additional container support. ```bash # MySQL/MariaDB support pip install django-testcontainers-plus[mysql] # Redis support pip install django-testcontainers-plus[redis] # S3 support (RustFS) pip install django-testcontainers-plus[s3] # Or install all pip install django-testcontainers-plus[all] ``` -------------------------------- ### Configure S3 storage in settings.py Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/s3.md Configure Django storage backends to use the S3 provider. These examples cover modern STORAGES, legacy DEFAULT_FILE_STORAGE, and combined static/media setups. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' STORAGES = { 'default': { 'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage', } } AWS_STORAGE_BUCKET_NAME = 'test-uploads' ``` ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' AWS_STORAGE_BUCKET_NAME = 'test-uploads' ``` ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' STORAGES = { 'default': { 'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage', }, 'staticfiles': { 'BACKEND': 'storages.backends.s3boto3.S3StaticStorage', } } AWS_STORAGE_BUCKET_NAME = 'test-uploads' ``` -------------------------------- ### Install database dependencies Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Install the necessary extras for specific database or service providers to resolve missing dependency errors. ```text ====================================================================== MySQL Support Not Installed ====================================================================== MySQL was detected in your Django settings: → DATABASES['default']['ENGINE'] To enable MySQL support, install the required dependencies: pip install django-testcontainers-plus[mysql] Or install all providers: pip install django-testcontainers-plus[all] ====================================================================== ``` ```bash # For MySQL/MariaDB pip install django-testcontainers-plus[mysql] # For Redis pip install django-testcontainers-plus[redis] # For S3 (RustFS) pip install django-testcontainers-plus[s3] # Or install everything pip install django-testcontainers-plus[all] ``` -------------------------------- ### Install Redis dependencies Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/troubleshooting.md Command to install Redis support for the package. ```bash pip install django-testcontainers-plus[redis] ``` -------------------------------- ### Development Workflow Commands Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Use these commands to set up the environment, install dependencies, and execute quality assurance tasks. ```bash # Clone the repository git clone https://github.com/woodywoodster/django-testcontainers-plus cd django-testcontainers-plus # Install dependencies (including all optional database clients) uv sync --all-extras --dev # Run tests uv run pytest # Run linting uv run ruff check . # Run type checking uv run mypy src/ ``` -------------------------------- ### Install S3 provider dependencies Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/s3.md Install the required extra package to enable S3 support. ```bash pip install django-testcontainers-plus[s3] ``` -------------------------------- ### Configure Minimal PostgreSQL Setup Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/postgres.md Set the test runner and define the database engine in settings.py to enable automatic container injection. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'myapp', } } ``` -------------------------------- ### Configure Multiple Services Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Define multiple service configurations in settings.py to have them auto-detected and started. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'test', } } CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://localhost:6379/0', } } ``` -------------------------------- ### Configure PostgreSQL and Redis Together Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Automatically start both PostgreSQL and Redis containers by defining their respective settings. ```python # settings.py TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'test', } } CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://localhost:6379/0', } } ``` -------------------------------- ### Configure Redis for Django Cache, Celery, or Both Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/redis.md Examples for configuring the Redis provider for specific Django components. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://localhost:6379/0', } } ``` ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' CELERY_BROKER_URL = 'redis://localhost:6379/0' ``` ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://localhost:6379/0', } } CELERY_BROKER_URL = 'redis://localhost:6379/0' ``` -------------------------------- ### Explicitly enable or disable providers Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/configuration.md Force a provider to start or stop regardless of auto-detection logic. ```python TESTCONTAINERS = { # Always start a postgres container, even if not in DATABASES 'postgres': { 'enabled': True, }, # Never start a redis container 'redis': { 'enabled': False, }, } ``` -------------------------------- ### Configure custom settings updates Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/redis.md Use the update_settings dictionary to manually control how settings are modified after the container starts. ```python TESTCONTAINERS = { 'redis': { 'update_settings': { 'CACHES': { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://localhost:6379/1', # different DB } } } } } ``` -------------------------------- ### Disable auto-detection Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/configuration.md Prevent a provider from starting automatically by setting auto to False. ```python TESTCONTAINERS = { 'redis': { 'auto': False, }, } ``` -------------------------------- ### Settings Injection Patch Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/how-it-works.md Example of the dictionary structure used to patch Django settings with container connection details. ```python { "DATABASES": { "default": { "HOST": "localhost", "PORT": "54321", # randomly assigned by Docker "USER": "test", "PASSWORD": "test", "NAME": "test", } } } ``` -------------------------------- ### Configure minimal MySQL settings Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/mysql.md Set the test runner and database engine in settings.py to enable the provider. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'myapp', } } ``` -------------------------------- ### Configure Redis in settings.py Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/redis.md Set the test runner and define the Redis cache backend to enable auto-detection. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://localhost:6379/0', } } ``` -------------------------------- ### Configure Multiple PostgreSQL Databases Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/postgres.md Define multiple database connections in settings.py; all PostgreSQL backends will point to the same container instance. ```python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'primary', }, 'analytics': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'analytics', }, } ``` -------------------------------- ### Configure Auto-Detection of Services Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Define standard Django settings to trigger automatic container detection and startup. ```python # PostgreSQL auto-detected DATABASES = { 'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'test'} } # Redis auto-detected CACHES = { 'default': {'BACKEND': 'django.core.cache.backends.redis.RedisCache'} } # Celery Redis auto-detected CELERY_BROKER_URL = 'redis://localhost:6379/0' # Mailhog auto-detected EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'localhost' ``` -------------------------------- ### Implement a new ContainerProvider Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Template for creating a new service provider by extending the ContainerProvider base class. ```python from .base import ContainerProvider class MongoDBProvider(ContainerProvider): @property def name(self) -> str: return "mongodb" def can_auto_detect(self, settings) -> bool: # Check Django settings for MongoDB references ... def get_container(self, config): # Create and return a configured DockerContainer ... def update_settings(self, container, settings, config): # Return a dict of Django settings updates ... def get_default_config(self): return {"image": "mongo:7"} ``` -------------------------------- ### Configure Database for Django Runner Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Define the database settings in settings.py without specifying host or port. ```python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'myapp', } } ``` -------------------------------- ### Run project tests Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Executes the test suite using pytest or the project's makefile. ```bash uv run pytest ``` ```bash make coverage ``` -------------------------------- ### Run MySQL with pytest Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Integrate the pytest plugin and configure database settings for MySQL testing. ```python # conftest.py pytest_plugins = ['django_testcontainers_plus.pytest_plugin'] # settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test', } } ``` ```bash pytest ``` -------------------------------- ### Configure pytest-django Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Enable the pytest plugin and configure the database settings for pytest-django. ```python # conftest.py pytest_plugins = ['django_testcontainers_plus.pytest_plugin'] ``` ```python # settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'test', } } ``` -------------------------------- ### Configure MariaDB container Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/mysql.md Specify a MariaDB image within the testcontainers configuration. ```python TESTCONTAINERS = { 'mysql': { 'image': 'mariadb:11', } } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'myapp', } } ``` -------------------------------- ### Define TESTCONTAINERS settings Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/configuration.md The base structure for configuring container providers in settings.py. ```python TESTCONTAINERS = { 'postgres': { ... }, 'mysql': { ... }, 'redis': { ... }, } ``` -------------------------------- ### Run PostgreSQL with Django Test Runner Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Configure the test runner and database settings to use a PostgreSQL container. ```python # settings.py TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'myapp', } } # Optional: Customize PostgreSQL version TESTCONTAINERS = { 'postgres': { 'image': 'postgres:15', } } ``` ```bash python manage.py test ``` -------------------------------- ### Project directory structure Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Overview of the source code organization. ```text src/django_testcontainers_plus/ ├── __init__.py ├── manager.py # Container lifecycle orchestration ├── runner.py # Django test runner integration ├── pytest_plugin.py # pytest fixtures ├── exceptions.py # Custom exceptions ├── utils.py # Utilities └── providers/ ├── base.py # Abstract ContainerProvider ├── postgres.py ├── mysql.py └── redis.py ``` -------------------------------- ### Configure Database for pytest Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Define database settings in settings.py for use with the pytest plugin. ```python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'test', } } ``` -------------------------------- ### Define Custom Container Settings Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Override default container images and configurations using the TESTCONTAINERS dictionary. ```python TESTCONTAINERS = { 'postgres': { 'image': 'postgres:16-alpine', 'username': 'testuser', 'password': 'testpass', 'dbname': 'testdb', }, 'redis': { 'image': 'redis:7-alpine', }, 'mailhog': { 'image': 'mailhog/mailhog:latest', }, } ``` -------------------------------- ### Run Django Tests Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Execute tests using the standard Django management command. ```bash python manage.py test ``` -------------------------------- ### Lifecycle Flowchart Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/how-it-works.md Visual representation of the test lifecycle from detection to teardown. ```text Test run starts │ ▼ 1. Detection Scan Django settings for known service patterns (DATABASES engines, CACHES backends, CELERY_BROKER_URL, etc.) │ ▼ 2. Configuration Merge detected needs with TESTCONTAINERS setting overrides │ ▼ 3. Startup Start Docker containers for each needed service │ ▼ 4. Injection Patch Django settings with container host/port/credentials │ ▼ 5. Your tests run against real services │ ▼ 6. Teardown Stop and remove all containers, restore original settings ``` -------------------------------- ### Run pytest Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Execute tests using the pytest command. ```bash pytest ``` -------------------------------- ### Customize PostgreSQL Container Options Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/postgres.md Override default container settings such as image, credentials, and environment variables using the TESTCONTAINERS dictionary. ```python TESTCONTAINERS = { 'postgres': { 'image': 'postgres:15-alpine', 'username': 'myuser', 'password': 'mysecret', 'dbname': 'myapp_test', 'environment': { 'POSTGRES_INITDB_ARGS': '--encoding=UTF8 --locale=en_US.UTF-8', }, } } ``` -------------------------------- ### Perform file operations in tests Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/s3.md Use Django's default_storage to interact with the S3 container during tests. ```python from django.core.files.base import ContentFile from django.core.files.storage import default_storage def test_file_upload(): # RustFS container is automatically started and configured content = ContentFile(b"Test file content") path = default_storage.save('uploads/test.txt', content) assert default_storage.exists(path) assert default_storage.open(path).read() == b"Test file content" default_storage.delete(path) assert not default_storage.exists(path) ``` -------------------------------- ### Enable PostGIS Manually Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/postgres.md Explicitly enable the PostgreSQL provider and specify a PostGIS image when using the PostGIS backend. ```python TESTCONTAINERS = { 'postgres': { 'enabled': True, 'image': 'postgis/postgis:16-3.4', } } DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'myapp', } } ``` -------------------------------- ### Perform code linting Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Checks code style and quality using ruff or the makefile. ```bash uv run ruff check . make lint ``` -------------------------------- ### Pass extra environment variables Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/configuration.md Inject additional environment variables into the container. ```python TESTCONTAINERS = { 'postgres': { 'environment': { 'POSTGRES_INITDB_ARGS': '--encoding=UTF8', }, }, } ``` -------------------------------- ### Customize MySQL container configuration Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/mysql.md Override default container settings such as image, credentials, and environment variables. ```python TESTCONTAINERS = { 'mysql': { 'image': 'mysql:8.0', 'username': 'myuser', 'password': 'mysecret', 'dbname': 'myapp_test', 'environment': { 'MYSQL_ROOT_PASSWORD': 'rootpass', }, } } ``` -------------------------------- ### Disable auto-detection for a service Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/troubleshooting.md Configuration to prevent automatic container startup for specific services. ```python TESTCONTAINERS = { 'redis': { 'auto': False, } } ``` -------------------------------- ### Customize provider Docker images Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/configuration.md Override default Docker images for specific providers. ```python TESTCONTAINERS = { 'postgres': { 'image': 'postgres:15-alpine', }, 'redis': { 'image': 'redis:7-alpine', }, } ``` -------------------------------- ### Verify Docker availability Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/installation.md Check if the Docker daemon is running and accessible. ```bash docker ps ``` -------------------------------- ### Configure Django Test Runner Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Set the custom test runner in settings.py to enable automatic container management. ```python TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' ``` -------------------------------- ### Perform type checking Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/help/contributing.md Validates type annotations using mypy or the makefile. ```bash uv run mypy src/ make typecheck ``` -------------------------------- ### Customize Redis container settings Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/redis.md Override default container image or environment variables via the TESTCONTAINERS dictionary. ```python TESTCONTAINERS = { 'redis': { 'image': 'redis:7-alpine', 'environment': { 'REDIS_ARGS': '--maxmemory 256mb', }, } } ``` -------------------------------- ### Customize S3 container settings Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/providers/s3.md Override default container configuration, including credentials and environment variables, via the TESTCONTAINERS dictionary. ```python TESTCONTAINERS = { 's3': { 'image': 'rustfs/rustfs', 'access_key': 'rustfsadmin', # used for boto3 + container auth 'secret_key': 'rustfsadmin', 'bucket_name': 'test-bucket', # auto-created bucket 'environment': { # extra container env vars 'RUSTFS_CONSOLE_ENABLE': 'true', }, } } ``` -------------------------------- ### Register pytest Plugin Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/getting-started/quickstart.md Add the plugin to conftest.py to enable testcontainers support in pytest. ```python pytest_plugins = ['django_testcontainers_plus.pytest_plugin'] ``` -------------------------------- ### Override database credentials Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/docs/pages/user-guide/configuration.md Specify custom database credentials for the postgres provider. ```python TESTCONTAINERS = { 'postgres': { 'username': 'myuser', 'password': 'mypassword', 'dbname': 'mydb', }, } ``` -------------------------------- ### Test Email Sending with Mailhog Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Use Mailhog to capture and verify outgoing emails via the injected MAILHOG_API_URL. ```python # settings.py TEST_RUNNER = 'django_testcontainers_plus.runner.TestcontainersRunner' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'localhost' EMAIL_PORT = 1025 ``` ```python # tests.py from django.core.mail import send_mail from django.conf import settings import requests def test_email_sending(): # Mailhog container is automatically started send_mail( 'Test Subject', 'Test message body', 'from@example.com', ['to@example.com'], fail_silently=False, ) # Retrieve sent emails via Mailhog API using MAILHOG_API_URL response = requests.get(f'{settings.MAILHOG_API_URL}/messages') messages = response.json()['items'] assert len(messages) == 1 assert messages[0]['Content']['Headers']['Subject'][0] == 'Test Subject' def test_clear_mailbox(): # Delete all messages before test requests.delete(f'{settings.MAILHOG_API_URL}/messages') # ... send emails and verify ``` -------------------------------- ### Disable service auto-detection Source: https://github.com/woodywoodster/django-testcontainers-plus/blob/main/README.md Configure the TESTCONTAINERS dictionary to explicitly disable auto-detection for specific services. ```python TESTCONTAINERS = { 'mysql': { 'auto': False, # Won't auto-detect MySQL 'enabled': False, # Explicitly disable } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.