diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2019-07-17 13:08:08 -0700 |
---|---|---|
committer | Greg Becker <becker33@llnl.gov> | 2019-07-17 15:08:08 -0500 |
commit | b856e24444c0bd9933abfd6f54551259e2dcf1dc (patch) | |
tree | 2b9d0490104d0c70c9c79616330c122c7a0393b8 | |
parent | 5cf88781854ad68ebd07c99aa97860b444c3a479 (diff) | |
download | spack-b856e24444c0bd9933abfd6f54551259e2dcf1dc.tar.gz spack-b856e24444c0bd9933abfd6f54551259e2dcf1dc.tar.bz2 spack-b856e24444c0bd9933abfd6f54551259e2dcf1dc.tar.xz spack-b856e24444c0bd9933abfd6f54551259e2dcf1dc.zip |
tests: uninstall_by_spec error and rpath_args tests (#11971)
* tests: Add uninstall_by_spec error tests.
These tests were originally included in PR #11797.
-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 |