From 91e35541ee9a87f588988a9dc7eadbc65e74d106 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 12 Jul 2019 08:32:47 -0700 Subject: 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. --- lib/spack/spack/cmd/__init__.py | 2 +- lib/spack/spack/test/cmd/find.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3-70-g09d2