Add more unit tests for spack list command (#6750)
This commit is contained in:
parent
d3913709bb
commit
0c1f4a7997
@ -55,7 +55,7 @@ def name_only(x):
|
||||
@pytest.mark.usefixtures('mock_name_only')
|
||||
class TestListCommand(object):
|
||||
|
||||
def test_list_without_filters(self, parser, pkg_names):
|
||||
def test_list(self, parser, pkg_names):
|
||||
|
||||
args = parser.parse_args([])
|
||||
spack.cmd.list.list(parser, args)
|
||||
@ -64,10 +64,40 @@ def test_list_without_filters(self, parser, pkg_names):
|
||||
assert 'cloverleaf3d' in pkg_names
|
||||
assert 'hdf5' in pkg_names
|
||||
|
||||
def test_list_with_filters(self, parser, pkg_names):
|
||||
def test_list_filter(self, parser, pkg_names):
|
||||
args = parser.parse_args(['py-*'])
|
||||
spack.cmd.list.list(parser, args)
|
||||
|
||||
assert pkg_names
|
||||
assert 'py-numpy' in pkg_names
|
||||
assert 'perl-file-copy-recursive' not in pkg_names
|
||||
|
||||
args = parser.parse_args(['py-'])
|
||||
spack.cmd.list.list(parser, args)
|
||||
|
||||
assert pkg_names
|
||||
assert 'py-numpy' in pkg_names
|
||||
assert 'perl-file-copy-recursive' in pkg_names
|
||||
|
||||
def test_list_search_description(self, parser, pkg_names):
|
||||
args = parser.parse_args(['--search-description', 'xml'])
|
||||
spack.cmd.list.list(parser, args)
|
||||
|
||||
assert pkg_names
|
||||
assert 'expat' in pkg_names
|
||||
|
||||
def test_list_tags(self, parser, pkg_names):
|
||||
args = parser.parse_args(['--tags', 'proxy-app'])
|
||||
spack.cmd.list.list(parser, args)
|
||||
|
||||
assert pkg_names
|
||||
assert 'cloverleaf3d' in pkg_names
|
||||
assert 'hdf5' not in pkg_names
|
||||
|
||||
def test_list_formatter(self, parser, pkg_names):
|
||||
# TODO: Test the output of the commands
|
||||
args = parser.parse_args(['--format', 'name_only'])
|
||||
spack.cmd.list.list(parser, args)
|
||||
|
||||
args = parser.parse_args(['--format', 'rst'])
|
||||
spack.cmd.list.list(parser, args)
|
||||
|
Loading…
Reference in New Issue
Block a user