diff options
Diffstat (limited to 'lib/spack/spack/test/database.py')
-rw-r--r-- | lib/spack/spack/test/database.py | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index 28311c7501..70f9bffe59 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -28,7 +28,7 @@ import spack.store import spack.database import spack.package import spack.spec -from spack.test.conftest import MockPackage, MockPackageMultiRepo +from spack.util.mock_package import MockPackageMultiRepo from spack.util.executable import Executable @@ -73,11 +73,11 @@ def test_installed_upstream(upstream_and_downstream_db): downstream_db, downstream_layout = (upstream_and_downstream_db) default = ('build', 'link') - x = MockPackage('x', [], []) - z = MockPackage('z', [], []) - y = MockPackage('y', [z], [default]) - w = MockPackage('w', [x, y], [default, default]) - mock_repo = MockPackageMultiRepo([w, x, y, z]) + mock_repo = MockPackageMultiRepo() + x = mock_repo.add_package('x', [], []) + z = mock_repo.add_package('z', [], []) + y = mock_repo.add_package('y', [z], [default]) + mock_repo.add_package('w', [x, y], [default, default]) with spack.repo.swap(mock_repo): spec = spack.spec.Spec('w') @@ -116,9 +116,9 @@ def test_removed_upstream_dep(upstream_and_downstream_db): downstream_db, downstream_layout = (upstream_and_downstream_db) default = ('build', 'link') - z = MockPackage('z', [], []) - y = MockPackage('y', [z], [default]) - mock_repo = MockPackageMultiRepo([y, z]) + mock_repo = MockPackageMultiRepo() + z = mock_repo.add_package('z', [], []) + mock_repo.add_package('y', [z], [default]) with spack.repo.swap(mock_repo): spec = spack.spec.Spec('y') @@ -150,8 +150,8 @@ def test_add_to_upstream_after_downstream(upstream_and_downstream_db): upstream_write_db, upstream_db, upstream_layout,\ downstream_db, downstream_layout = (upstream_and_downstream_db) - x = MockPackage('x', [], []) - mock_repo = MockPackageMultiRepo([x]) + mock_repo = MockPackageMultiRepo() + mock_repo.add_package('x', [], []) with spack.repo.swap(mock_repo): spec = spack.spec.Spec('x') @@ -183,8 +183,8 @@ def test_cannot_write_upstream(tmpdir_factory, test_store, gen_mock_layout): roots = [str(tmpdir_factory.mktemp(x)) for x in ['a', 'b']] layouts = [gen_mock_layout(x) for x in ['/ra/', '/rb/']] - x = MockPackage('x', [], []) - mock_repo = MockPackageMultiRepo([x]) + mock_repo = MockPackageMultiRepo() + mock_repo.add_package('x', [], []) # Instantiate the database that will be used as the upstream DB and make # sure it has an index file @@ -209,11 +209,10 @@ def test_recursive_upstream_dbs(tmpdir_factory, test_store, gen_mock_layout): layouts = [gen_mock_layout(x) for x in ['/ra/', '/rb/', '/rc/']] default = ('build', 'link') - z = MockPackage('z', [], []) - y = MockPackage('y', [z], [default]) - x = MockPackage('x', [y], [default]) - - mock_repo = MockPackageMultiRepo([x, y, z]) + mock_repo = MockPackageMultiRepo() + z = mock_repo.add_package('z', [], []) + y = mock_repo.add_package('y', [z], [default]) + mock_repo.add_package('x', [y], [default]) with spack.repo.swap(mock_repo): spec = spack.spec.Spec('x') @@ -675,7 +674,7 @@ def test_115_reindex_with_packages_not_in_repo(mutable_database): # Dont add any package definitions to this repository, the idea is that # packages should not have to be defined in the repository once they # are installed - with spack.repo.swap(MockPackageMultiRepo([])): + with spack.repo.swap(MockPackageMultiRepo()): spack.store.store.reindex() _check_db_sanity(mutable_database) |