spack/lib/spack/docs
Todd Gamblin 4beb9fc5d3 tests: improved spack test command line options
Previously, `spack test` automatically passed all of its arguments to
`pytest -k` if no options were provided, and to `pytest` if they were.
`spack test -l` also provided a list of test filenames, but they didn't
really let you completely narrow down which tests you wanted to run.

Instead of trying to do our own weird thing, this passes `spack test`
args directly to `pytest`, and omits the implicit `-k`.  This means we
can now run, e.g.:

```console
$ spack test spec_syntax.py::TestSpecSyntax::test_ambiguous
```

This wasn't possible before, because we'd pass the fully qualified name
to `pytest -k` and get an error.

Because `pytest` doesn't have the greatest ability to list tests, I've
tweaked the `-l`/`--list`, `-L`/`--list-long`, and `-N`/`--list-names`
options to `spack test` so that they help you understand the names
better.  you can combine these options with `-k` or other arguments to do
pretty powerful searches.

This one makes it easy to get a list of names so you can run tests in
different orders (something I find useful for debugging `pytest` issues):

```console
$ spack test --list-names -k "spec and concretize"
cmd/env.py::test_concretize_user_specs_together
concretize.py::TestConcretize::test_conflicts_in_spec
concretize.py::TestConcretize::test_find_spec_children
concretize.py::TestConcretize::test_find_spec_none
concretize.py::TestConcretize::test_find_spec_parents
concretize.py::TestConcretize::test_find_spec_self
concretize.py::TestConcretize::test_find_spec_sibling
concretize.py::TestConcretize::test_no_matching_compiler_specs
concretize.py::TestConcretize::test_simultaneous_concretization_of_specs
spec_dag.py::TestSpecDag::test_concretize_deptypes
spec_dag.py::TestSpecDag::test_copy_concretized
```

You can combine any list option with keywords:

```console
$ spack test --list -k microarchitecture
llnl/util/cpu.py  modules/lmod.py
```

```console
$ spack test --list-long -k microarchitecture
llnl/util/cpu.py::
    test_generic_microarchitecture

modules/lmod.py::TestLmod::
    test_only_generic_microarchitectures_in_root
```

Or just list specific files:

```console
$ spack test --list-long cmd/test.py
cmd/test.py::
    test_list                       test_list_names_with_pytest_arg
    test_list_long                  test_list_with_keywords
    test_list_long_with_pytest_arg  test_list_with_pytest_arg
    test_list_names
```

Hopefully this stuff will help with debugging test issues.

- [x] make `spack test` send args directly to `pytest` instead of trying
  to do fancy things.
- [x] rework `--list`, `--list-long`, and add `--list-names` to make
  searching for tests easier.
- [x] make it possible to mix Spack's list args with `pytest` args
  (they're just fancy parsing around `pytest --collect-only`)
- [x] add docs
- [x] add tests
- [x] update spack completion
2020-01-01 21:37:02 -08:00
..
_gh_pages_redirect Make gh-pages redirect to readthedocs.io 2016-08-31 19:40:22 -07:00
_static make empty _static directory "exist" to git 2014-01-09 14:03:32 +01:00
build_systems copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
example_files Implement an optional compiler bootstrapping phase 2019-09-13 22:57:15 -07:00
_spack_root docs: make docs build relocatable for localized builds 2019-05-26 18:23:44 -07:00
.gitignore tutorial: move tutorial to standalone site (#13450) 2019-10-25 21:49:27 -07:00
basic_usage.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
binary_caches.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
build_settings.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
build_systems.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
chain.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
command_index.in Rework command reference in docs, add spack commands command 2018-02-12 20:25:17 -08:00
conf.py copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
config_yaml.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
configuration.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
contribution_guide.rst tests: improved spack test command line options 2020-01-01 21:37:02 -08:00
developer_guide.rst tests: improved spack test command line options 2020-01-01 21:37:02 -08:00
docker_for_developers.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
environments.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
extensions.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
features.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
getting_started.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
index.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
known_issues.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
Makefile docs: match ReadTheDocs; use -W (warnings as errors) with Sphinx 2019-05-26 18:23:44 -07:00
mirrors.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
module_file_generation.svg SC17: reworked module file tutorial section (#5657) 2017-11-12 00:27:20 -08:00
module_file_support.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
package_list.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
packaging_guide.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
repositories.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
requirements.txt Docs: unlock requirement versions (#13384) 2019-10-31 14:21:05 -05:00
spack.yaml copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
workflows.rst copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00