File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 1616import spack .store
1717from spack .spec import Spec
1818from spack .package import _spack_build_envfile , _spack_build_logfile
19- import spack .modules .common
2019
2120
2221def test_install_and_uninstall (install_mockery , mock_fetch , monkeypatch ):
@@ -40,8 +39,6 @@ def find_nothing(*args):
4039 with pytest .raises (spack .repo .UnknownPackageError ):
4140 spec .package
4241
43- module_path = spack .modules .common .get_module ('tcl' , spec , True )
44- assert module_path
4542 pkg .do_uninstall ()
4643 except Exception :
4744 pkg .remove_prefix ()
Original file line number Diff line number Diff line change 1111import spack .spec
1212import spack .modules .tcl
1313from spack .modules .common import UpstreamModuleIndex
14+ from spack .spec import Spec
1415
1516import spack .error
1617
@@ -183,3 +184,31 @@ def test_get_module_upstream():
183184 assert m1_path == '/path/to/a'
184185 finally :
185186 spack .modules .common .upstream_module_index = old_index
187+
188+ def test_load_installed_package_not_in_repo (install_mockery , mock_fetch , monkeypatch ):
189+ # Get a basic concrete spec for the trivial install package.
190+ spec = Spec ('trivial-install-test-package' )
191+ spec .concretize ()
192+ assert spec .concrete
193+
194+ # Get the package
195+ pkg = spec .package
196+
197+ def find_nothing (* args ):
198+ raise spack .repo .UnknownPackageError (
199+ 'Repo package access is disabled for test' )
200+
201+ try :
202+ pkg .do_install ()
203+
204+ spec ._package = None
205+ monkeypatch .setattr (spack .repo , 'get' , find_nothing )
206+ with pytest .raises (spack .repo .UnknownPackageError ):
207+ spec .package
208+
209+ module_path = spack .modules .common .get_module ('tcl' , spec , True )
210+ assert module_path
211+ pkg .do_uninstall ()
212+ except Exception :
213+ pkg .remove_prefix ()
214+ raise
You can’t perform that action at this time.
0 commit comments