def test_clone_from_cache_local(tmpdir): """ when a cached version already exists on disk, this uses a version and should succeed""" setup_local_cache(tmpdir.path) output = os.path.join(tmpdir.path, 'dest') assert checkout.clone_from_cache(TEST_HG_REPO_TAR.split('.')[0], None, output, cache_dir=tmpdir.path) assert os.path.exists(os.path.join(output, '.hg', 'hgrc'))
def setup_hg_repo(topdir, dest='dest'): """ setup a hg repository in the given folder using clone_from_cache""" setup_local_cache(topdir) output = os.path.join(topdir, dest) checkout.clone_from_cache(TEST_HG_REPO_TAR.split('.')[0], None, output, cache_dir=topdir) return output
def test_clone_from_cache_bad_namespace(tmpdir): """ this should fail since the namespace is invalid.""" latest_artifact_url = checkout.urljoin(checkout.TC_INDEX, 'task', 'bar') with mocked_urllib2({'http://bad.url/': '{"taskId":"baz"}'}, no_size=True): assert not checkout.clone_from_cache('foo', 'bar', None, tmpdir.path)