def test_try_install_from_binary_cache(install_mockery, mock_packages, monkeypatch): """Test return false when no match exists in the mirror""" spec = spack.spec.Spec('mpich') spec.concretize() result = inst._try_install_from_binary_cache(spec.package, False, False) assert (not result)
def test_try_install_from_binary_cache(install_mockery, mock_packages, monkeypatch, capsys): """Tests SystemExit path for_try_install_from_binary_cache.""" def _spec(spec, force): spec = spack.spec.Spec('mpi').concretized() return {spec: None} spec = spack.spec.Spec('mpich') spec.concretize() monkeypatch.setattr(spack.binary_distribution, 'get_spec', _spec) with pytest.raises(SystemExit): inst._try_install_from_binary_cache(spec.package, False, False) captured = capsys.readouterr() assert 'add a spack mirror to allow download' in str(captured)
def test_try_install_from_binary_cache(install_mockery, mock_packages, monkeypatch): """Tests SystemExit path for_try_install_from_binary_cache. This test does not make sense. We tell spack there is a mirror with a binary for this spec and then expect it to die because there are no mirrors configured.""" # def _mirrors_for_spec(spec, full_hash_match=False): # spec = spack.spec.Spec('mpi').concretized() # return [{ # 'mirror_url': 'notused', # 'spec': spec, # }] spec = spack.spec.Spec('mpich') spec.concretize() # monkeypatch.setattr( # spack.binary_distribution, 'get_mirrors_for_spec', _mirrors_for_spec) # with pytest.raises(SystemExit): # inst._try_install_from_binary_cache(spec.package, False, False) result = inst._try_install_from_binary_cache(spec.package, False, False) assert (not result)