# 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
                container.start()
                container.reload()

                assert container.status == 'running'

                docker_helper.containers.remove(container, force=True)

                with pytest.raises(NotFound):
                    container.reload()
        """.format(IMG))

        result = testdir.runpytest()
        result.assert_outcomes(passed=1)


@dockertest()
class TestImageFetchFixtureFunc:
    def test_fixture(self, testdir):
        """
        When the fixture is used in a test, the image passed to the test
        should have the right tag.
        """
        testdir.makeconftest("""
            from seaworthy.pytest.fixtures import image_fetch_fixture

            fixture = image_fetch_fixture('busybox', name='image')
        """.format(IMG))

        testdir.makepyfile("""
            def test_image_fetch(image):

# 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

                container.start()
                container.reload()

                assert container.status == 'running'

                docker_helper.containers.remove(container, force=True)

                with pytest.raises(NotFound):
                    container.reload()
        """.format(IMG))

        result = testdir.runpytest()
        result.assert_outcomes(passed=1)


@dockertest()
class TestImageFetchFixtureFunc:
    def test_fixture(self, testdir):
        """
        When the fixture is used in a test, the image passed to the test
        should have the right tag.
        """
        testdir.makeconftest("""
            from seaworthy.pytest.fixtures import image_fetch_fixture

            fixture = image_fetch_fixture('busybox', name='image')
        """.format(IMG))

        testdir.makepyfile("""
            def test_image_fetch(image):

                assert 'busybox:latest' in image.tags