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.
This commit is contained in:
Todd Gamblin 2019-07-12 08:32:47 -07:00 committed by GitHub
parent 52e0f47a3f
commit 91e35541ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -264,7 +264,7 @@ def get_arg(name, default=None):
hashes = True hashes = True
hlen = None hlen = None
nfmt = '{namespace}{name}' if namespace else '{name}' nfmt = '{namespace}.{name}' if namespace else '{name}'
ffmt = '' ffmt = ''
if full_compiler or flags: if full_compiler or flags:
ffmt += '{%compiler.name}' ffmt += '{%compiler.name}'

View file

@ -7,9 +7,13 @@
import pytest import pytest
import spack.cmd.find import spack.cmd.find
from spack.main import SpackCommand
from spack.util.pattern import Bunch from spack.util.pattern import Bunch
find = SpackCommand('find')
@pytest.fixture(scope='module') @pytest.fixture(scope='module')
def parser(): def parser():
"""Returns the parser for the module command""" """Returns the parser for the module command"""
@ -98,3 +102,12 @@ def test_tag2_tag3(parser, specs):
spack.cmd.find.find(parser, args) spack.cmd.find.find(parser, args)
assert len(specs) == 0 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