diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2017-12-22 13:29:20 -0500 |
---|---|---|
committer | scheibelp <scheibel1@llnl.gov> | 2017-12-22 10:29:20 -0800 |
commit | 0c1f4a799700b92ef9bfd54d209ffb4c252f9fae (patch) | |
tree | 0f77d2330e413f32d2f2a46c36ac63245556405c /lib | |
parent | d3913709bb9c87d728ef537391ff21fb4e25e17f (diff) | |
download | spack-0c1f4a799700b92ef9bfd54d209ffb4c252f9fae.tar.gz spack-0c1f4a799700b92ef9bfd54d209ffb4c252f9fae.tar.bz2 spack-0c1f4a799700b92ef9bfd54d209ffb4c252f9fae.tar.xz spack-0c1f4a799700b92ef9bfd54d209ffb4c252f9fae.zip |
Add more unit tests for spack list command (#6750)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/cmd/list.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/lib/spack/spack/test/cmd/list.py b/lib/spack/spack/test/cmd/list.py index 9fe335a6e3..976bacb9fb 100644 --- a/lib/spack/spack/test/cmd/list.py +++ b/lib/spack/spack/test/cmd/list.py @@ -55,7 +55,7 @@ def mock_name_only(monkeypatch, pkg_names): @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 @@ class TestListCommand(object): 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) |