diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2019-07-12 08:32:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 08:32:47 -0700 |
commit | 91e35541ee9a87f588988a9dc7eadbc65e74d106 (patch) | |
tree | b0699a1e07d862c9a10c66bb0ec658abec4446c0 | |
parent | 52e0f47a3ff67bd0c8a31c6755b384dedd70ee02 (diff) | |
download | spack-91e35541ee9a87f588988a9dc7eadbc65e74d106.tar.gz spack-91e35541ee9a87f588988a9dc7eadbc65e74d106.tar.bz2 spack-91e35541ee9a87f588988a9dc7eadbc65e74d106.tar.xz spack-91e35541ee9a87f588988a9dc7eadbc65e74d106.zip |
bugfix: show dot after namespaces in `spack find -N` (#11945)
- Namepsaces were shown without dots after the new format strings were
added.
- Add a test for `spack find` to ensure that find -N shows the right
output.
-rw-r--r-- | lib/spack/spack/cmd/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/find.py | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index d1efb99e62..c289edc86c 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -264,7 +264,7 @@ def display_specs(specs, args=None, **kwargs): hashes = True hlen = None - nfmt = '{namespace}{name}' if namespace else '{name}' + nfmt = '{namespace}.{name}' if namespace else '{name}' ffmt = '' if full_compiler or flags: ffmt += '{%compiler.name}' diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py index 832582f2c2..7ee5487cc4 100644 --- a/lib/spack/spack/test/cmd/find.py +++ b/lib/spack/spack/test/cmd/find.py @@ -7,9 +7,13 @@ import argparse import pytest import spack.cmd.find +from spack.main import SpackCommand from spack.util.pattern import Bunch +find = SpackCommand('find') + + @pytest.fixture(scope='module') def parser(): """Returns the parser for the module command""" @@ -98,3 +102,12 @@ def test_tag2_tag3(parser, specs): spack.cmd.find.find(parser, args) assert len(specs) == 0 + + +@pytest.mark.db +def test_namespaces_shown_correctly(database): + out = find() + assert 'builtin.mock.zmpi' not in out + + out = find('--namespace') + assert 'builtin.mock.zmpi' in out |