def test_process_binary_cache_tarball_none(install_mockery, monkeypatch, capfd): """Tests of _process_binary_cache_tarball when no tarball.""" monkeypatch.setattr(spack.binary_distribution, 'download_tarball', _none) pkg = spack.repo.get('trivial-install-test-package') assert not inst._process_binary_cache_tarball(pkg, None, False, False) assert 'exists in binary cache but' in capfd.readouterr()[0]
def test_process_binary_cache_tarball_tar(install_mockery, monkeypatch, capfd): """Tests of _process_binary_cache_tarball with a tar file.""" def _spec(spec, url=None): return spec # Skip binary distribution functionality since assume tested elsewhere monkeypatch.setattr(spack.binary_distribution, 'download_tarball', _spec) monkeypatch.setattr(spack.binary_distribution, 'extract_tarball', _noop) # Skip database updates monkeypatch.setattr(spack.database.Database, 'add', _noop) spec = spack.spec.Spec('a').concretized() assert inst._process_binary_cache_tarball(spec.package, spec, False, False) assert 'Extracting a from binary cache' in capfd.readouterr()[0]