-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from douglasjacobsen/detect_undefined_packages
Detect undefined packages and print a useful error message
- Loading branch information
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -829,3 +829,32 @@ def test_environment_vector_expansion_exclusion(mutable_mock_workspace_path): | |
assert 'basic-x86_64' in software_environments._environments.keys() | ||
assert 'basic-x86_64_v4' not in software_environments._environments.keys() | ||
assert 'basic-x86_64' in software_environments._environments['basic-x86_64']['packages'] | ||
|
||
|
||
def test_environment_with_missing_package_errors(mutable_mock_workspace_path, capsys): | ||
ws_name = 'test_environment_with_missing_package_errors' | ||
workspace('create', ws_name) | ||
|
||
assert ws_name in workspace('list') | ||
|
||
with ramble.workspace.read(ws_name) as ws: | ||
spack_dict = ws.get_spack_dict() | ||
|
||
spack_dict['packages'] = {} | ||
spack_dict['packages']['basic'] = { | ||
'spack_spec': '[email protected]', | ||
} | ||
spack_dict['environments'] = { | ||
'basic': { | ||
'packages': ['basic', 'undefined_package'] | ||
} | ||
} | ||
|
||
with pytest.raises(SystemExit): | ||
ramble.software_environments.SoftwareEnvironments(ws) | ||
output = capsys.readouterr() | ||
|
||
assert 'Error: Environment basic refers to the following packages' in output | ||
assert 'undefined_package' in output | ||
assert 'Please make sure all packages are defined before using this environment' \ | ||
in output |