'Attempt to start an application using an image which must be pulled
from a registry but don\'t give the pull operation enough time to
complete.  Assert that the result is a timeout error of some kind.
:return: A ``Deferred`` firing with a two-tuple of a ``DockerImage``
and a ``Registry``.  The former represents the image we attempted
to use, the latter represents the registry we should have tried to
pull it from.'

def _pull_timeout(self):

    client = dockerpy_client()
    running = self.run_registry()
    def build_dummy_image(registry):
        path = FilePath(self.mktemp())
        path.makedirs()
        path.child('Dockerfile.in').setContent('FROM    busybox\nCMD    /bin/true\n')
        builder = DockerImageBuilder(test=self, source_dir=path, cleanup=False)
        building = builder.build()
        building.addCallback((lambda image_name: (image_name, registry)))
        return building
    running.addCallback(build_dummy_image)
    def cleanup_image(image_name):
        for image in client.images():
            if (image_name in image['RepoTags']):
                client.remove_image(image_name, force=True)
                return
    def cleanup_registry(registry):
        try:
            client.unpause((self.namespacing_prefix + registry.name))
        except APIError:
            pass
    def setup_image((image_name, registry)):
        registry_image = self.push_to_registry(image_name, registry)
        self.addCleanup(cleanup_image, image_name)
        client.pause((self.namespacing_prefix + registry.name))
        self.addCleanup(cleanup_registry, registry)
        docker_client = DockerClient(namespace=self.namespacing_prefix, long_timeout=1)
        app_name = random_name(self)
        d = docker_client.add(app_name, registry_image.full_name)
        self.assertFailure(d, ReadTimeout)
        d.addCallback((lambda ignored: (registry_image, registry)))
        return d
    running.addCallback(setup_image)
    return running
