{"library":"pytest-container","title":"pytest-container","description":"Pytest fixtures for writing container-based tests with support for OCI containers (Docker/Podman). Version 0.4.4 provides decorators and fixtures to manage container lifecycle. Active development, monthly releases.","language":"python","status":"active","last_verified":"Mon Apr 27","install":{"commands":["pip install pytest-container"],"cli":null},"imports":["from pytest_container import container","from pytest_container import DerivedContainer"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pytest_container import container, DerivedContainer\n\ndef test_container(container):\n    # container is a pytest fixture that starts a container\n    # inspect container object\n    assert container.connection.run(\"echo hello\").stdout.strip() == \"hello\"\n\n# Define custom container image\nclass TestWithCustomImage:\n    CONTAINER_IMAGE = DerivedContainer(\n        base=\"registry.opensuse.org/opensuse/tumbleweed:latest\",\n        containerfile=\"\"\"\nRUN zypper -n in python3\n        \"\"\"\n    )\n    def test_custom(self, container):\n        assert container.connection.run(\"python3 --version\").rc == 0","lang":"python","description":"Basic usage: use the container fixture or define a custom DerivedContainer class.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}