# Path: seaworthy/checks.py
# @contextmanager
# def docker_client():
#     """
#     A context manager that creates and cleans up a Docker API client.
# 
#     In most cases, it's better to use :class:`~seaworthy.helpers.DockerHelper`
#     instead.
#     """
#     client = docker.client.from_env()
#     yield client
#     client.api.close()
# 
# Path: seaworthy/helpers.py
# def fetch_images(client, images):
#     """
#     Fetch images if they aren't already present.
#     """
#     return [fetch_image(client, image) for image in images]
# 
# Path: seaworthy/pytest/checks.py
# def dockertest():
#     """
#     Skip tests that require Docker to be available.
# 
#     This is a function that returns a decorator so that we don't run arbitrary
#     Docker client code on import. Unlike :func:`seaworthy.checks.dockertest`,
#     this implementation doesn't require :class:`unittest.TestCase`. It does,
#     however, require pytest.
#     """
#     return pytest.mark.skipif(
#         not docker_available(), reason='Docker not available.')


from seaworthy.checks import docker_client
from seaworthy.helpers import fetch_images
from seaworthy.pytest.checks import dockertest
            from seaworthy.definitions import ContainerDefinition
            from seaworthy.pytest.fixtures import clean_container_fixtures


            class CleanableContainer(ContainerDefinition):
                def __init__(self):
                    super().__init__(name='test', image='{}')
                    self.cleaned = False

                def clean(self):
                    self.cleaned = True

                def was_cleaned(self):
                    cleaned = self.cleaned
                    self.cleaned = False
                    return cleaned


            f1, f2 = CleanableContainer().pytest_clean_fixtures('cleanable')
        """.format(IMG))

        testdir.makepyfile("""
            import pytest


            def test_dirty(cleanable):
                assert not cleanable.was_cleaned()
                assert cleanable.inner().status == 'running'

            @pytest.mark.clean_cleanable

# Path: seaworthy/checks.py
# @contextmanager
# def docker_client():
#     """
#     A context manager that creates and cleans up a Docker API client.
# 
#     In most cases, it's better to use :class:`~seaworthy.helpers.DockerHelper`
#     instead.
#     """
#     client = docker.client.from_env()
#     yield client
#     client.api.close()
# 
# Path: seaworthy/helpers.py
# def fetch_images(client, images):
#     """
#     Fetch images if they aren't already present.
#     """
#     return [fetch_image(client, image) for image in images]
# 
# Path: seaworthy/pytest/checks.py
# def dockertest():
#     """
#     Skip tests that require Docker to be available.
# 
#     This is a function that returns a decorator so that we don't run arbitrary
#     Docker client code on import. Unlike :func:`seaworthy.checks.dockertest`,
#     this implementation doesn't require :class:`unittest.TestCase`. It does,
#     however, require pytest.
#     """
#     return pytest.mark.skipif(
#         not docker_available(), reason='Docker not available.')


# Path: seaworthy/tests-pytest/test_fixtures_pytester.py
from seaworthy.checks import docker_client
from seaworthy.helpers import fetch_images
from seaworthy.pytest.checks import dockertest

            from seaworthy.definitions import ContainerDefinition
            from seaworthy.pytest.fixtures import clean_container_fixtures


            class CleanableContainer(ContainerDefinition):
                def __init__(self):
                    super().__init__(name='test', image='{}')
                    self.cleaned = False

                def clean(self):
                    self.cleaned = True

                def was_cleaned(self):
                    cleaned = self.cleaned
                    self.cleaned = False
                    return cleaned


            f1, f2 = CleanableContainer().pytest_clean_fixtures('cleanable')
        """.format(IMG))

        testdir.makepyfile("""
            import pytest


            def test_dirty(cleanable):
                assert not cleanable.was_cleaned()
                assert cleanable.inner().status == 'running'

            @pytest.mark.clean_cleanable

            def test_clean(cleanable):