Contributing¶
Contributions are welcome! Here's how to get started.
Development Setup¶
This project uses uv for package management.
git clone https://github.com/WoodyWoodster/django-testcontainers-plus
cd django-testcontainers-plus
uv sync --all-extras --dev
Running Tests¶
Code Quality¶
Linting:
Type checking:
Adding a New Provider¶
To add support for a new service (e.g. MongoDB):
- Create
src/django_testcontainers_plus/providers/mongodb.py - Implement the
ContainerProviderabstract base class:
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"}
- Register your provider in
src/django_testcontainers_plus/providers/__init__.py - Add tests in
tests/test_mongodb_provider.py - Add documentation in
docs/pages/providers/mongodb.md
Submitting a Pull Request¶
- Fork the repository
- Create a feature branch:
git checkout -b feat/mongodb-provider - Make your changes with tests
- Ensure all checks pass:
make lint typecheck coverage - Open a Pull Request against
main
Project Structure¶
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