Skip to content

Commit

Permalink
bugfix: show dot after namespaces in spack find -N (spack#11945)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
tgamblin authored Jul 12, 2019
1 parent 52e0f47 commit 91e3554
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/spack/spack/cmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_arg(name, default=None):
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}'
Expand Down
13 changes: 13 additions & 0 deletions lib/spack/spack/test/cmd/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@

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"""
Expand Down Expand Up @@ -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

0 comments on commit 91e3554

Please sign in to comment.