Testing Container Images with Python and Pytest
summary
pytest_container is a pytest plugin that actually pulls, builds, launches and destroys images for tests, exposes a connection to run Testinfra checks, and auto pull/build/launch/cleanup of containers and volumes (including removing anonymous volumes). It finds free host ports and binds them, supports Docker and Podman selectable by env var, can create pods and shared networks, defaults to reusing containers but offers container-per-test, and waits for container health checks before running tests.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 0:41Python and pytest for container testing
- 1:47pytest-container plugin features
- 3:54Test case with openSUSE Tumbleweed
- 5:19Practical container testing
- 6:45Building derived images
- 7:26Port binding in parallel tests
- 8:08Podman pods setup
- 9:09Container cleanup and isolation
- 9:52Parameterizing container tests
- 10:33Inspecting container properties
- 11:16Bind mounts and volumes
- 11:37Health checks and readiness
- 12:42Docker versus Podman
- 13:02Parallel execution and cleanup
- 13:46Projects and acknowledgments
- 14:26Q&A
related talks
28mTesting Complex Python Dependencies With Docker Containers
51mTestContainers: Integration Testing Without the Hassle
48mTestContainers: The Revolution for Your Unit Tests
37mFrom mocking to rocking your tests with testcontainers
23mCleaning Up Your Python Environment Superfund Site
34mModern development environments for Pythonistas
26mIntegration testing for container images via Kind in GitLab CI
20mContainer Testing with conu
