예제 #1
0
def test_installer_init_errors(install_mockery):
    """Test to ensure cover installer constructor errors."""
    with pytest.raises(ValueError, match='must be a package'):
        inst.PackageInstaller('abc')

    pkg = spack.repo.get('trivial-install-test-package')
    with pytest.raises(ValueError, match='Can only install concrete'):
        inst.PackageInstaller(pkg)
예제 #2
0
def test_installer_last_phase_error(install_mockery, capsys):
    spec = spack.spec.Spec('trivial-install-test-package')
    spec.concretize()
    assert spec.concrete
    with pytest.raises(SystemExit):
        installer = inst.PackageInstaller(spec.package)
        installer.install(stop_at='badphase')

    captured = capsys.readouterr()
    assert 'is not an allowed phase' in str(captured)
예제 #3
0
파일: installer.py 프로젝트: tomdele/spack
def create_installer(installer_args):
    """
    Create an installer using the concretized spec for each arg

    Args:
        installer_args (list of tuples): the list of (spec name, kwargs) tuples

    Return:
        installer (PackageInstaller): the associated package installer
    """
    const_arg = [(spec.package, kwargs) for spec, kwargs in installer_args]
    return inst.PackageInstaller(const_arg)
예제 #4
0
def create_installer(spec_name):
    """
    Create an installer for the named spec

    Args:
        spec_name (str):  Name of the explicit install spec

    Return:
        spec (Spec): concretized spec
        installer (PackageInstaller): the associated package installer
    """
    spec = spack.spec.Spec(spec_name)
    spec.concretize()
    assert spec.concrete
    return spec, inst.PackageInstaller(spec.package)