diff options
-rw-r--r-- | lib/spack/spack/test/install.py | 16 | ||||
-rw-r--r-- | lib/spack/spack/test/packages.py | 10 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py index ec70bdec42..296322b7ed 100644 --- a/lib/spack/spack/test/install.py +++ b/lib/spack/spack/test/install.py @@ -9,6 +9,7 @@ import shutil from llnl.util.filesystem import mkdirp, touch, working_dir +from spack.package import InstallError, PackageBase, PackageStillNeededError import spack.patch import spack.repo import spack.store @@ -275,6 +276,21 @@ class MockInstallError(spack.error.SpackError): pass +def test_uninstall_by_spec_errors(mutable_database): + """Test exceptional cases with the uninstall command.""" + + # Try to uninstall a spec that has not been installed + rec = mutable_database.get_record('zmpi') + with pytest.raises(InstallError, matches="not installed"): + PackageBase.uninstall_by_spec(rec.spec) + + # Try an unforced uninstall of a spec with dependencies + rec = mutable_database.get_record('mpich') + + with pytest.raises(PackageStillNeededError, matches="cannot uninstall"): + PackageBase.uninstall_by_spec(rec.spec) + + def test_pkg_build_paths(install_mockery): # Get a basic concrete spec for the trivial install package. spec = Spec('trivial-install-test-package').concretized() diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py index d0b570e2af..43f1719ca3 100644 --- a/lib/spack/spack/test/packages.py +++ b/lib/spack/spack/test/packages.py @@ -353,3 +353,13 @@ def test_git_url_top_level_conflicts(mock_packages, config): with pytest.raises(spack.fetch_strategy.FetcherConflict): spack.fetch_strategy.for_package_version(pkg, '1.3') + + +def test_rpath_args(mutable_database): + """Test a package's rpath_args property.""" + + rec = mutable_database.get_record('mpich') + + rpath_args = rec.spec.package.rpath_args + assert '-rpath' in rpath_args + assert 'mpich' in rpath_args |