Fixes #760: spack test leaves builtin.mock packages in DB
- install_layout was redirected by the install test, but not the DB. - redirect the DB now, as well.
This commit is contained in:
parent
73213ac59d
commit
b4c36164b5
2 changed files with 7 additions and 2 deletions
|
@ -165,7 +165,7 @@ def remove_install_directory(self, spec):
|
||||||
class YamlDirectoryLayout(DirectoryLayout):
|
class YamlDirectoryLayout(DirectoryLayout):
|
||||||
"""Lays out installation directories like this::
|
"""Lays out installation directories like this::
|
||||||
<install root>/
|
<install root>/
|
||||||
<target>/
|
<platform-os-target>/
|
||||||
<compiler>-<compiler version>/
|
<compiler>-<compiler version>/
|
||||||
<name>-<version>-<variants>-<hash>
|
<name>-<version>-<variants>-<hash>
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
import spack
|
import spack
|
||||||
from llnl.util.filesystem import *
|
from llnl.util.filesystem import *
|
||||||
from spack.directory_layout import YamlDirectoryLayout
|
from spack.directory_layout import YamlDirectoryLayout
|
||||||
|
from spack.database import Database
|
||||||
from spack.fetch_strategy import URLFetchStrategy, FetchStrategyComposite
|
from spack.fetch_strategy import URLFetchStrategy, FetchStrategyComposite
|
||||||
from spack.test.mock_packages_test import *
|
from spack.test.mock_packages_test import *
|
||||||
from spack.test.mock_repo import MockArchive
|
from spack.test.mock_repo import MockArchive
|
||||||
|
@ -49,7 +50,10 @@ def setUp(self):
|
||||||
# installed pkgs and mock packages.
|
# installed pkgs and mock packages.
|
||||||
self.tmpdir = tempfile.mkdtemp()
|
self.tmpdir = tempfile.mkdtemp()
|
||||||
self.orig_layout = spack.install_layout
|
self.orig_layout = spack.install_layout
|
||||||
|
self.orig_db = spack.installed_db
|
||||||
|
|
||||||
spack.install_layout = YamlDirectoryLayout(self.tmpdir)
|
spack.install_layout = YamlDirectoryLayout(self.tmpdir)
|
||||||
|
spack.installed_db = Database(self.tmpdir)
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
@ -61,6 +65,7 @@ def tearDown(self):
|
||||||
|
|
||||||
# restore spack's layout.
|
# restore spack's layout.
|
||||||
spack.install_layout = self.orig_layout
|
spack.install_layout = self.orig_layout
|
||||||
|
spack.installed_db = self.orig_db
|
||||||
shutil.rmtree(self.tmpdir, ignore_errors=True)
|
shutil.rmtree(self.tmpdir, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +76,7 @@ def fake_fetchify(self, pkg):
|
||||||
pkg.fetcher = fetcher
|
pkg.fetcher = fetcher
|
||||||
|
|
||||||
|
|
||||||
def ztest_install_and_uninstall(self):
|
def test_install_and_uninstall(self):
|
||||||
# Get a basic concrete spec for the trivial install package.
|
# Get a basic concrete spec for the trivial install package.
|
||||||
spec = Spec('trivial_install_test_package')
|
spec = Spec('trivial_install_test_package')
|
||||||
spec.concretize()
|
spec.concretize()
|
||||||
|
|
Loading…
Reference in a new issue