summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-11-18 15:08:59 +0100
committerGitHub <noreply@github.com>2021-11-18 15:08:59 +0100
commitf981682bdc0ca0235d04629c358643be610a860d (patch)
tree04e3e84a03f606de17c1dd1001648610c1720d12 /lib
parent8f7640dbefd1adbd7e4104a404fa018f851776b5 (diff)
downloadspack-f981682bdc0ca0235d04629c358643be610a860d.tar.gz
spack-f981682bdc0ca0235d04629c358643be610a860d.tar.bz2
spack-f981682bdc0ca0235d04629c358643be610a860d.tar.xz
spack-f981682bdc0ca0235d04629c358643be610a860d.zip
Allow recent pytest versions to be used with Spack (#25371)
Currently Spack vendors `pytest` at a version which is three major versions behind the latest (3.2.5 vs. 6.2.4). We do that since v3.2.5 is the latest version supporting Python 2.6. Remaining so much behind the currently supported versions though might introduce some incompatibilities and is surely a technical debt. This PR modifies Spack to: - Use the vendored `pytest@3.2.5` only as a fallback solution, if the Python interpreter used for Spack doesn't provide a newer one - Be able to parse `pytest --collect-only` in all the different output formats from v3.2.5 to v6.2.4 and use it consistently for `spack unit-test --list-*` - Updating the unit tests in Github Actions to use a more recent `pytest` version
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/conf.py1
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/LICENSE (renamed from lib/spack/external/_pytest/LICENSE)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/__init__.py (renamed from lib/spack/external/_pytest/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_argcomplete.py (renamed from lib/spack/external/_pytest/_argcomplete.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_code/__init__.py (renamed from lib/spack/external/_pytest/_code/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_code/_py2traceback.py (renamed from lib/spack/external/_pytest/_code/_py2traceback.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_code/code.py (renamed from lib/spack/external/_pytest/_code/code.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_code/source.py (renamed from lib/spack/external/_pytest/_code/source.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_pluggy.py (renamed from lib/spack/external/_pytest/_pluggy.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/_version.py (renamed from lib/spack/external/_pytest/_version.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/assertion/__init__.py (renamed from lib/spack/external/_pytest/assertion/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/assertion/rewrite.py (renamed from lib/spack/external/_pytest/assertion/rewrite.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/assertion/truncate.py (renamed from lib/spack/external/_pytest/assertion/truncate.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/assertion/util.py (renamed from lib/spack/external/_pytest/assertion/util.py)0
-rwxr-xr-xlib/spack/external/pytest-fallback/_pytest/cacheprovider.py (renamed from lib/spack/external/_pytest/cacheprovider.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/capture.py (renamed from lib/spack/external/_pytest/capture.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/compat.py (renamed from lib/spack/external/_pytest/compat.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/config.py (renamed from lib/spack/external/_pytest/config.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/debugging.py (renamed from lib/spack/external/_pytest/debugging.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/deprecated.py (renamed from lib/spack/external/_pytest/deprecated.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/doctest.py (renamed from lib/spack/external/_pytest/doctest.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/fixtures.py (renamed from lib/spack/external/_pytest/fixtures.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/freeze_support.py (renamed from lib/spack/external/_pytest/freeze_support.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/helpconfig.py (renamed from lib/spack/external/_pytest/helpconfig.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/hookspec.py (renamed from lib/spack/external/_pytest/hookspec.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/junitxml.py (renamed from lib/spack/external/_pytest/junitxml.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/main.py (renamed from lib/spack/external/_pytest/main.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/mark.py (renamed from lib/spack/external/_pytest/mark.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/monkeypatch.py (renamed from lib/spack/external/_pytest/monkeypatch.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/nodes.py (renamed from lib/spack/external/_pytest/nodes.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/nose.py (renamed from lib/spack/external/_pytest/nose.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/outcomes.py (renamed from lib/spack/external/_pytest/outcomes.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/pastebin.py (renamed from lib/spack/external/_pytest/pastebin.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/pytester.py (renamed from lib/spack/external/_pytest/pytester.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/python.py (renamed from lib/spack/external/_pytest/python.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/python_api.py (renamed from lib/spack/external/_pytest/python_api.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/recwarn.py (renamed from lib/spack/external/_pytest/recwarn.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/resultlog.py (renamed from lib/spack/external/_pytest/resultlog.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/runner.py (renamed from lib/spack/external/_pytest/runner.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/setuponly.py (renamed from lib/spack/external/_pytest/setuponly.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/setupplan.py (renamed from lib/spack/external/_pytest/setupplan.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/skipping.py (renamed from lib/spack/external/_pytest/skipping.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/terminal.py (renamed from lib/spack/external/_pytest/terminal.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/tmpdir.py (renamed from lib/spack/external/_pytest/tmpdir.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/unittest.py (renamed from lib/spack/external/_pytest/unittest.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/README.md (renamed from lib/spack/external/_pytest/vendored_packages/README.md)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/__init__.py (renamed from lib/spack/external/_pytest/vendored_packages/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt (renamed from lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy.py (renamed from lib/spack/external/_pytest/vendored_packages/pluggy.py)0
-rw-r--r--lib/spack/external/pytest-fallback/_pytest/warnings.py (renamed from lib/spack/external/_pytest/warnings.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/__init__.py (renamed from lib/spack/external/py/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/__metainfo.py (renamed from lib/spack/external/py/__metainfo.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_apipkg.py (renamed from lib/spack/external/py/_apipkg.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_builtin.py (renamed from lib/spack/external/py/_builtin.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/__init__.py (renamed from lib/spack/external/py/_code/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/_assertionnew.py (renamed from lib/spack/external/py/_code/_assertionnew.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/_assertionold.py (renamed from lib/spack/external/py/_code/_assertionold.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/_py2traceback.py (renamed from lib/spack/external/py/_code/_py2traceback.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/assertion.py (renamed from lib/spack/external/py/_code/assertion.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/code.py (renamed from lib/spack/external/py/_code/code.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_code/source.py (renamed from lib/spack/external/py/_code/source.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_error.py (renamed from lib/spack/external/py/_error.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_iniconfig.py (renamed from lib/spack/external/py/_iniconfig.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_io/__init__.py (renamed from lib/spack/external/py/_io/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_io/capture.py (renamed from lib/spack/external/py/_io/capture.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_io/saferepr.py (renamed from lib/spack/external/py/_io/saferepr.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_io/terminalwriter.py (renamed from lib/spack/external/py/_io/terminalwriter.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_log/__init__.py (renamed from lib/spack/external/py/_log/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_log/log.py (renamed from lib/spack/external/py/_log/log.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_log/warning.py (renamed from lib/spack/external/py/_log/warning.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_path/__init__.py (renamed from lib/spack/external/py/_path/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_path/cacheutil.py (renamed from lib/spack/external/py/_path/cacheutil.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_path/common.py (renamed from lib/spack/external/py/_path/common.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_path/local.py (renamed from lib/spack/external/py/_path/local.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_path/svnurl.py (renamed from lib/spack/external/py/_path/svnurl.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_path/svnwc.py (renamed from lib/spack/external/py/_path/svnwc.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_process/__init__.py (renamed from lib/spack/external/py/_process/__init__.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_process/cmdexec.py (renamed from lib/spack/external/py/_process/cmdexec.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_process/forkedfunc.py (renamed from lib/spack/external/py/_process/forkedfunc.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_process/killproc.py (renamed from lib/spack/external/py/_process/killproc.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_std.py (renamed from lib/spack/external/py/_std.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/_xmlgen.py (renamed from lib/spack/external/py/_xmlgen.py)0
-rw-r--r--lib/spack/external/pytest-fallback/py/test.py (renamed from lib/spack/external/py/test.py)0
-rw-r--r--lib/spack/external/pytest-fallback/pytest.py (renamed from lib/spack/external/pytest.py)0
-rw-r--r--lib/spack/spack/cmd/unit_test.py86
-rw-r--r--lib/spack/spack/test/cmd/unit_test.py5
-rw-r--r--lib/spack/spack/test/conftest.py12
94 files changed, 76 insertions, 28 deletions
diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py
index 2b58223e1d..d0a2bb9e33 100644
--- a/lib/spack/docs/conf.py
+++ b/lib/spack/docs/conf.py
@@ -30,6 +30,7 @@ from sphinx.ext.apidoc import main as sphinx_apidoc
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('_spack_root/lib/spack/external'))
+sys.path.insert(0, os.path.abspath('_spack_root/lib/spack/external/pytest-fallback'))
if sys.version_info[0] < 3:
sys.path.insert(
diff --git a/lib/spack/external/_pytest/LICENSE b/lib/spack/external/pytest-fallback/_pytest/LICENSE
index 629df45ac4..629df45ac4 100644
--- a/lib/spack/external/_pytest/LICENSE
+++ b/lib/spack/external/pytest-fallback/_pytest/LICENSE
diff --git a/lib/spack/external/_pytest/__init__.py b/lib/spack/external/pytest-fallback/_pytest/__init__.py
index 6e41f0504e..6e41f0504e 100644
--- a/lib/spack/external/_pytest/__init__.py
+++ b/lib/spack/external/pytest-fallback/_pytest/__init__.py
diff --git a/lib/spack/external/_pytest/_argcomplete.py b/lib/spack/external/pytest-fallback/_pytest/_argcomplete.py
index 965ec79513..965ec79513 100644
--- a/lib/spack/external/_pytest/_argcomplete.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_argcomplete.py
diff --git a/lib/spack/external/_pytest/_code/__init__.py b/lib/spack/external/pytest-fallback/_pytest/_code/__init__.py
index 815c13b42c..815c13b42c 100644
--- a/lib/spack/external/_pytest/_code/__init__.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_code/__init__.py
diff --git a/lib/spack/external/_pytest/_code/_py2traceback.py b/lib/spack/external/pytest-fallback/_pytest/_code/_py2traceback.py
index 5aacf0a428..5aacf0a428 100644
--- a/lib/spack/external/_pytest/_code/_py2traceback.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_code/_py2traceback.py
diff --git a/lib/spack/external/_pytest/_code/code.py b/lib/spack/external/pytest-fallback/_pytest/_code/code.py
index f3b7eedfce..f3b7eedfce 100644
--- a/lib/spack/external/_pytest/_code/code.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_code/code.py
diff --git a/lib/spack/external/_pytest/_code/source.py b/lib/spack/external/pytest-fallback/_pytest/_code/source.py
index fc41712649..fc41712649 100644
--- a/lib/spack/external/_pytest/_code/source.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_code/source.py
diff --git a/lib/spack/external/_pytest/_pluggy.py b/lib/spack/external/pytest-fallback/_pytest/_pluggy.py
index 6cc1d3d54a..6cc1d3d54a 100644
--- a/lib/spack/external/_pytest/_pluggy.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_pluggy.py
diff --git a/lib/spack/external/_pytest/_version.py b/lib/spack/external/pytest-fallback/_pytest/_version.py
index 3edb7da9ad..3edb7da9ad 100644
--- a/lib/spack/external/_pytest/_version.py
+++ b/lib/spack/external/pytest-fallback/_pytest/_version.py
diff --git a/lib/spack/external/_pytest/assertion/__init__.py b/lib/spack/external/pytest-fallback/_pytest/assertion/__init__.py
index b0ef667d56..b0ef667d56 100644
--- a/lib/spack/external/_pytest/assertion/__init__.py
+++ b/lib/spack/external/pytest-fallback/_pytest/assertion/__init__.py
diff --git a/lib/spack/external/_pytest/assertion/rewrite.py b/lib/spack/external/pytest-fallback/_pytest/assertion/rewrite.py
index d48b6648fb..d48b6648fb 100644
--- a/lib/spack/external/_pytest/assertion/rewrite.py
+++ b/lib/spack/external/pytest-fallback/_pytest/assertion/rewrite.py
diff --git a/lib/spack/external/_pytest/assertion/truncate.py b/lib/spack/external/pytest-fallback/_pytest/assertion/truncate.py
index 1e13063569..1e13063569 100644
--- a/lib/spack/external/_pytest/assertion/truncate.py
+++ b/lib/spack/external/pytest-fallback/_pytest/assertion/truncate.py
diff --git a/lib/spack/external/_pytest/assertion/util.py b/lib/spack/external/pytest-fallback/_pytest/assertion/util.py
index c09eff06b0..c09eff06b0 100644
--- a/lib/spack/external/_pytest/assertion/util.py
+++ b/lib/spack/external/pytest-fallback/_pytest/assertion/util.py
diff --git a/lib/spack/external/_pytest/cacheprovider.py b/lib/spack/external/pytest-fallback/_pytest/cacheprovider.py
index c537c14472..c537c14472 100755
--- a/lib/spack/external/_pytest/cacheprovider.py
+++ b/lib/spack/external/pytest-fallback/_pytest/cacheprovider.py
diff --git a/lib/spack/external/_pytest/capture.py b/lib/spack/external/pytest-fallback/_pytest/capture.py
index cb5af6fcb3..cb5af6fcb3 100644
--- a/lib/spack/external/_pytest/capture.py
+++ b/lib/spack/external/pytest-fallback/_pytest/capture.py
diff --git a/lib/spack/external/_pytest/compat.py b/lib/spack/external/pytest-fallback/_pytest/compat.py
index 255f69ce0d..255f69ce0d 100644
--- a/lib/spack/external/_pytest/compat.py
+++ b/lib/spack/external/pytest-fallback/_pytest/compat.py
diff --git a/lib/spack/external/_pytest/config.py b/lib/spack/external/pytest-fallback/_pytest/config.py
index 513478a972..513478a972 100644
--- a/lib/spack/external/_pytest/config.py
+++ b/lib/spack/external/pytest-fallback/_pytest/config.py
diff --git a/lib/spack/external/_pytest/debugging.py b/lib/spack/external/pytest-fallback/_pytest/debugging.py
index aa9c9a3863..aa9c9a3863 100644
--- a/lib/spack/external/_pytest/debugging.py
+++ b/lib/spack/external/pytest-fallback/_pytest/debugging.py
diff --git a/lib/spack/external/_pytest/deprecated.py b/lib/spack/external/pytest-fallback/_pytest/deprecated.py
index 38e9496778..38e9496778 100644
--- a/lib/spack/external/_pytest/deprecated.py
+++ b/lib/spack/external/pytest-fallback/_pytest/deprecated.py
diff --git a/lib/spack/external/_pytest/doctest.py b/lib/spack/external/pytest-fallback/_pytest/doctest.py
index 4c05acddf7..4c05acddf7 100644
--- a/lib/spack/external/_pytest/doctest.py
+++ b/lib/spack/external/pytest-fallback/_pytest/doctest.py
diff --git a/lib/spack/external/_pytest/fixtures.py b/lib/spack/external/pytest-fallback/_pytest/fixtures.py
index 98317a4889..98317a4889 100644
--- a/lib/spack/external/_pytest/fixtures.py
+++ b/lib/spack/external/pytest-fallback/_pytest/fixtures.py
diff --git a/lib/spack/external/_pytest/freeze_support.py b/lib/spack/external/pytest-fallback/_pytest/freeze_support.py
index 97147a8825..97147a8825 100644
--- a/lib/spack/external/_pytest/freeze_support.py
+++ b/lib/spack/external/pytest-fallback/_pytest/freeze_support.py
diff --git a/lib/spack/external/_pytest/helpconfig.py b/lib/spack/external/pytest-fallback/_pytest/helpconfig.py
index e744637f86..e744637f86 100644
--- a/lib/spack/external/_pytest/helpconfig.py
+++ b/lib/spack/external/pytest-fallback/_pytest/helpconfig.py
diff --git a/lib/spack/external/_pytest/hookspec.py b/lib/spack/external/pytest-fallback/_pytest/hookspec.py
index e5c966e58b..e5c966e58b 100644
--- a/lib/spack/external/_pytest/hookspec.py
+++ b/lib/spack/external/pytest-fallback/_pytest/hookspec.py
diff --git a/lib/spack/external/_pytest/junitxml.py b/lib/spack/external/pytest-fallback/_pytest/junitxml.py
index 7fb40dc354..7fb40dc354 100644
--- a/lib/spack/external/_pytest/junitxml.py
+++ b/lib/spack/external/pytest-fallback/_pytest/junitxml.py
diff --git a/lib/spack/external/_pytest/main.py b/lib/spack/external/pytest-fallback/_pytest/main.py
index 98aa28eb34..98aa28eb34 100644
--- a/lib/spack/external/_pytest/main.py
+++ b/lib/spack/external/pytest-fallback/_pytest/main.py
diff --git a/lib/spack/external/_pytest/mark.py b/lib/spack/external/pytest-fallback/_pytest/mark.py
index 454722ca2c..454722ca2c 100644
--- a/lib/spack/external/_pytest/mark.py
+++ b/lib/spack/external/pytest-fallback/_pytest/mark.py
diff --git a/lib/spack/external/_pytest/monkeypatch.py b/lib/spack/external/pytest-fallback/_pytest/monkeypatch.py
index 39ac770135..39ac770135 100644
--- a/lib/spack/external/_pytest/monkeypatch.py
+++ b/lib/spack/external/pytest-fallback/_pytest/monkeypatch.py
diff --git a/lib/spack/external/_pytest/nodes.py b/lib/spack/external/pytest-fallback/_pytest/nodes.py
index ad3af2ce67..ad3af2ce67 100644
--- a/lib/spack/external/_pytest/nodes.py
+++ b/lib/spack/external/pytest-fallback/_pytest/nodes.py
diff --git a/lib/spack/external/_pytest/nose.py b/lib/spack/external/pytest-fallback/_pytest/nose.py
index d246c5603d..d246c5603d 100644
--- a/lib/spack/external/_pytest/nose.py
+++ b/lib/spack/external/pytest-fallback/_pytest/nose.py
diff --git a/lib/spack/external/_pytest/outcomes.py b/lib/spack/external/pytest-fallback/_pytest/outcomes.py
index ff5ef756d9..ff5ef756d9 100644
--- a/lib/spack/external/_pytest/outcomes.py
+++ b/lib/spack/external/pytest-fallback/_pytest/outcomes.py
diff --git a/lib/spack/external/_pytest/pastebin.py b/lib/spack/external/pytest-fallback/_pytest/pastebin.py
index 9d689819f0..9d689819f0 100644
--- a/lib/spack/external/_pytest/pastebin.py
+++ b/lib/spack/external/pytest-fallback/_pytest/pastebin.py
diff --git a/lib/spack/external/_pytest/pytester.py b/lib/spack/external/pytest-fallback/_pytest/pytester.py
index 82aa00e0d2..82aa00e0d2 100644
--- a/lib/spack/external/_pytest/pytester.py
+++ b/lib/spack/external/pytest-fallback/_pytest/pytester.py
diff --git a/lib/spack/external/_pytest/python.py b/lib/spack/external/pytest-fallback/_pytest/python.py
index 41fd2bdb7f..41fd2bdb7f 100644
--- a/lib/spack/external/_pytest/python.py
+++ b/lib/spack/external/pytest-fallback/_pytest/python.py
diff --git a/lib/spack/external/_pytest/python_api.py b/lib/spack/external/pytest-fallback/_pytest/python_api.py
index a931b4d2c7..a931b4d2c7 100644
--- a/lib/spack/external/_pytest/python_api.py
+++ b/lib/spack/external/pytest-fallback/_pytest/python_api.py
diff --git a/lib/spack/external/_pytest/recwarn.py b/lib/spack/external/pytest-fallback/_pytest/recwarn.py
index c9fa872c07..c9fa872c07 100644
--- a/lib/spack/external/_pytest/recwarn.py
+++ b/lib/spack/external/pytest-fallback/_pytest/recwarn.py
diff --git a/lib/spack/external/_pytest/resultlog.py b/lib/spack/external/pytest-fallback/_pytest/resultlog.py
index 9f9c2d1f65..9f9c2d1f65 100644
--- a/lib/spack/external/_pytest/resultlog.py
+++ b/lib/spack/external/pytest-fallback/_pytest/resultlog.py
diff --git a/lib/spack/external/_pytest/runner.py b/lib/spack/external/pytest-fallback/_pytest/runner.py
index b643fa3c91..b643fa3c91 100644
--- a/lib/spack/external/_pytest/runner.py
+++ b/lib/spack/external/pytest-fallback/_pytest/runner.py
diff --git a/lib/spack/external/_pytest/setuponly.py b/lib/spack/external/pytest-fallback/_pytest/setuponly.py
index 15e195ad5a..15e195ad5a 100644
--- a/lib/spack/external/_pytest/setuponly.py
+++ b/lib/spack/external/pytest-fallback/_pytest/setuponly.py
diff --git a/lib/spack/external/_pytest/setupplan.py b/lib/spack/external/pytest-fallback/_pytest/setupplan.py
index e11bd40698..e11bd40698 100644
--- a/lib/spack/external/_pytest/setupplan.py
+++ b/lib/spack/external/pytest-fallback/_pytest/setupplan.py
diff --git a/lib/spack/external/_pytest/skipping.py b/lib/spack/external/pytest-fallback/_pytest/skipping.py
index b92800d10b..b92800d10b 100644
--- a/lib/spack/external/_pytest/skipping.py
+++ b/lib/spack/external/pytest-fallback/_pytest/skipping.py
diff --git a/lib/spack/external/_pytest/terminal.py b/lib/spack/external/pytest-fallback/_pytest/terminal.py
index 9da94d0c91..9da94d0c91 100644
--- a/lib/spack/external/_pytest/terminal.py
+++ b/lib/spack/external/pytest-fallback/_pytest/terminal.py
diff --git a/lib/spack/external/_pytest/tmpdir.py b/lib/spack/external/pytest-fallback/_pytest/tmpdir.py
index da1b032237..da1b032237 100644
--- a/lib/spack/external/_pytest/tmpdir.py
+++ b/lib/spack/external/pytest-fallback/_pytest/tmpdir.py
diff --git a/lib/spack/external/_pytest/unittest.py b/lib/spack/external/pytest-fallback/_pytest/unittest.py
index 52c9813e8b..52c9813e8b 100644
--- a/lib/spack/external/_pytest/unittest.py
+++ b/lib/spack/external/pytest-fallback/_pytest/unittest.py
diff --git a/lib/spack/external/_pytest/vendored_packages/README.md b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/README.md
index b5fe6febb0..b5fe6febb0 100644
--- a/lib/spack/external/_pytest/vendored_packages/README.md
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/README.md
diff --git a/lib/spack/external/_pytest/vendored_packages/__init__.py b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/__init__.py
index e69de29bb2..e69de29bb2 100644
--- a/lib/spack/external/_pytest/vendored_packages/__init__.py
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/__init__.py
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst
index da0e7a6ed7..da0e7a6ed7 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER
index a1b589e38a..a1b589e38a 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt
index 121017d086..121017d086 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA
index bd88517c94..bd88517c94 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD
index 3003a3bf2b..3003a3bf2b 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL
index 8b6dd1b5a8..8b6dd1b5a8 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json
index cde22aff02..cde22aff02 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt
index 11bdb5c1f5..11bdb5c1f5 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt
diff --git a/lib/spack/external/_pytest/vendored_packages/pluggy.py b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy.py
index 6f26552d73..6f26552d73 100644
--- a/lib/spack/external/_pytest/vendored_packages/pluggy.py
+++ b/lib/spack/external/pytest-fallback/_pytest/vendored_packages/pluggy.py
diff --git a/lib/spack/external/_pytest/warnings.py b/lib/spack/external/pytest-fallback/_pytest/warnings.py
index 926b1f5811..926b1f5811 100644
--- a/lib/spack/external/_pytest/warnings.py
+++ b/lib/spack/external/pytest-fallback/_pytest/warnings.py
diff --git a/lib/spack/external/py/__init__.py b/lib/spack/external/pytest-fallback/py/__init__.py
index 85af650f5c..85af650f5c 100644
--- a/lib/spack/external/py/__init__.py
+++ b/lib/spack/external/pytest-fallback/py/__init__.py
diff --git a/lib/spack/external/py/__metainfo.py b/lib/spack/external/pytest-fallback/py/__metainfo.py
index 12581eb7af..12581eb7af 100644
--- a/lib/spack/external/py/__metainfo.py
+++ b/lib/spack/external/pytest-fallback/py/__metainfo.py
diff --git a/lib/spack/external/py/_apipkg.py b/lib/spack/external/pytest-fallback/py/_apipkg.py
index a73b8f6d0b..a73b8f6d0b 100644
--- a/lib/spack/external/py/_apipkg.py
+++ b/lib/spack/external/pytest-fallback/py/_apipkg.py
diff --git a/lib/spack/external/py/_builtin.py b/lib/spack/external/pytest-fallback/py/_builtin.py
index 52ee9d79ca..52ee9d79ca 100644
--- a/lib/spack/external/py/_builtin.py
+++ b/lib/spack/external/pytest-fallback/py/_builtin.py
diff --git a/lib/spack/external/py/_code/__init__.py b/lib/spack/external/pytest-fallback/py/_code/__init__.py
index f15acf8513..f15acf8513 100644
--- a/lib/spack/external/py/_code/__init__.py
+++ b/lib/spack/external/pytest-fallback/py/_code/__init__.py
diff --git a/lib/spack/external/py/_code/_assertionnew.py b/lib/spack/external/pytest-fallback/py/_code/_assertionnew.py
index afb1b31ff0..afb1b31ff0 100644
--- a/lib/spack/external/py/_code/_assertionnew.py
+++ b/lib/spack/external/pytest-fallback/py/_code/_assertionnew.py
diff --git a/lib/spack/external/py/_code/_assertionold.py b/lib/spack/external/pytest-fallback/py/_code/_assertionold.py
index 4e81fb3ef6..4e81fb3ef6 100644
--- a/lib/spack/external/py/_code/_assertionold.py
+++ b/lib/spack/external/pytest-fallback/py/_code/_assertionold.py
diff --git a/lib/spack/external/py/_code/_py2traceback.py b/lib/spack/external/pytest-fallback/py/_code/_py2traceback.py
index d65e27cb73..d65e27cb73 100644
--- a/lib/spack/external/py/_code/_py2traceback.py
+++ b/lib/spack/external/pytest-fallback/py/_code/_py2traceback.py
diff --git a/lib/spack/external/py/_code/assertion.py b/lib/spack/external/pytest-fallback/py/_code/assertion.py
index 4ce80c75b1..4ce80c75b1 100644
--- a/lib/spack/external/py/_code/assertion.py
+++ b/lib/spack/external/pytest-fallback/py/_code/assertion.py
diff --git a/lib/spack/external/py/_code/code.py b/lib/spack/external/pytest-fallback/py/_code/code.py
index 20fd965c97..20fd965c97 100644
--- a/lib/spack/external/py/_code/code.py
+++ b/lib/spack/external/pytest-fallback/py/_code/code.py
diff --git a/lib/spack/external/py/_code/source.py b/lib/spack/external/pytest-fallback/py/_code/source.py
index c8b668b2fb..c8b668b2fb 100644
--- a/lib/spack/external/py/_code/source.py
+++ b/lib/spack/external/pytest-fallback/py/_code/source.py
diff --git a/lib/spack/external/py/_error.py b/lib/spack/external/pytest-fallback/py/_error.py
index 8ca339beba..8ca339beba 100644
--- a/lib/spack/external/py/_error.py
+++ b/lib/spack/external/pytest-fallback/py/_error.py
diff --git a/lib/spack/external/py/_iniconfig.py b/lib/spack/external/pytest-fallback/py/_iniconfig.py
index 92b50bd853..92b50bd853 100644
--- a/lib/spack/external/py/_iniconfig.py
+++ b/lib/spack/external/pytest-fallback/py/_iniconfig.py
diff --git a/lib/spack/external/py/_io/__init__.py b/lib/spack/external/pytest-fallback/py/_io/__init__.py
index 835f01f3ab..835f01f3ab 100644
--- a/lib/spack/external/py/_io/__init__.py
+++ b/lib/spack/external/pytest-fallback/py/_io/__init__.py
diff --git a/lib/spack/external/py/_io/capture.py b/lib/spack/external/pytest-fallback/py/_io/capture.py
index bc157ed978..bc157ed978 100644
--- a/lib/spack/external/py/_io/capture.py
+++ b/lib/spack/external/pytest-fallback/py/_io/capture.py
diff --git a/lib/spack/external/py/_io/saferepr.py b/lib/spack/external/pytest-fallback/py/_io/saferepr.py
index 8518290efd..8518290efd 100644
--- a/lib/spack/external/py/_io/saferepr.py
+++ b/lib/spack/external/pytest-fallback/py/_io/saferepr.py
diff --git a/lib/spack/external/py/_io/terminalwriter.py b/lib/spack/external/pytest-fallback/py/_io/terminalwriter.py
index 390e8ca7b9..390e8ca7b9 100644
--- a/lib/spack/external/py/_io/terminalwriter.py
+++ b/lib/spack/external/pytest-fallback/py/_io/terminalwriter.py
diff --git a/lib/spack/external/py/_log/__init__.py b/lib/spack/external/pytest-fallback/py/_log/__init__.py
index fad62e960d..fad62e960d 100644
--- a/lib/spack/external/py/_log/__init__.py
+++ b/lib/spack/external/pytest-fallback/py/_log/__init__.py
diff --git a/lib/spack/external/py/_log/log.py b/lib/spack/external/pytest-fallback/py/_log/log.py
index ce47e8c754..ce47e8c754 100644
--- a/lib/spack/external/py/_log/log.py
+++ b/lib/spack/external/pytest-fallback/py/_log/log.py
diff --git a/lib/spack/external/py/_log/warning.py b/lib/spack/external/pytest-fallback/py/_log/warning.py
index 722e31e910..722e31e910 100644
--- a/lib/spack/external/py/_log/warning.py
+++ b/lib/spack/external/pytest-fallback/py/_log/warning.py
diff --git a/lib/spack/external/py/_path/__init__.py b/lib/spack/external/pytest-fallback/py/_path/__init__.py
index 51f3246f80..51f3246f80 100644
--- a/lib/spack/external/py/_path/__init__.py
+++ b/lib/spack/external/pytest-fallback/py/_path/__init__.py
diff --git a/lib/spack/external/py/_path/cacheutil.py b/lib/spack/external/pytest-fallback/py/_path/cacheutil.py
index 9922504750..9922504750 100644
--- a/lib/spack/external/py/_path/cacheutil.py
+++ b/lib/spack/external/pytest-fallback/py/_path/cacheutil.py
diff --git a/lib/spack/external/py/_path/common.py b/lib/spack/external/pytest-fallback/py/_path/common.py
index 5512e51efe..5512e51efe 100644
--- a/lib/spack/external/py/_path/common.py
+++ b/lib/spack/external/pytest-fallback/py/_path/common.py
diff --git a/lib/spack/external/py/_path/local.py b/lib/spack/external/pytest-fallback/py/_path/local.py
index d2f16b993e..d2f16b993e 100644
--- a/lib/spack/external/py/_path/local.py
+++ b/lib/spack/external/pytest-fallback/py/_path/local.py
diff --git a/lib/spack/external/py/_path/svnurl.py b/lib/spack/external/pytest-fallback/py/_path/svnurl.py
index 6589a71d09..6589a71d09 100644
--- a/lib/spack/external/py/_path/svnurl.py
+++ b/lib/spack/external/pytest-fallback/py/_path/svnurl.py
diff --git a/lib/spack/external/py/_path/svnwc.py b/lib/spack/external/pytest-fallback/py/_path/svnwc.py
index 992223c04a..992223c04a 100644
--- a/lib/spack/external/py/_path/svnwc.py
+++ b/lib/spack/external/pytest-fallback/py/_path/svnwc.py
diff --git a/lib/spack/external/py/_process/__init__.py b/lib/spack/external/pytest-fallback/py/_process/__init__.py
index 86c714ad1a..86c714ad1a 100644
--- a/lib/spack/external/py/_process/__init__.py
+++ b/lib/spack/external/pytest-fallback/py/_process/__init__.py
diff --git a/lib/spack/external/py/_process/cmdexec.py b/lib/spack/external/pytest-fallback/py/_process/cmdexec.py
index f83a249402..f83a249402 100644
--- a/lib/spack/external/py/_process/cmdexec.py
+++ b/lib/spack/external/pytest-fallback/py/_process/cmdexec.py
diff --git a/lib/spack/external/py/_process/forkedfunc.py b/lib/spack/external/pytest-fallback/py/_process/forkedfunc.py
index 1c28530688..1c28530688 100644
--- a/lib/spack/external/py/_process/forkedfunc.py
+++ b/lib/spack/external/pytest-fallback/py/_process/forkedfunc.py
diff --git a/lib/spack/external/py/_process/killproc.py b/lib/spack/external/pytest-fallback/py/_process/killproc.py
index 18e8310b5f..18e8310b5f 100644
--- a/lib/spack/external/py/_process/killproc.py
+++ b/lib/spack/external/pytest-fallback/py/_process/killproc.py
diff --git a/lib/spack/external/py/_std.py b/lib/spack/external/pytest-fallback/py/_std.py
index 97a9853323..97a9853323 100644
--- a/lib/spack/external/py/_std.py
+++ b/lib/spack/external/pytest-fallback/py/_std.py
diff --git a/lib/spack/external/py/_xmlgen.py b/lib/spack/external/pytest-fallback/py/_xmlgen.py
index 1c83545884..1c83545884 100644
--- a/lib/spack/external/py/_xmlgen.py
+++ b/lib/spack/external/pytest-fallback/py/_xmlgen.py
diff --git a/lib/spack/external/py/test.py b/lib/spack/external/pytest-fallback/py/test.py
index aa5beb1789..aa5beb1789 100644
--- a/lib/spack/external/py/test.py
+++ b/lib/spack/external/pytest-fallback/py/test.py
diff --git a/lib/spack/external/pytest.py b/lib/spack/external/pytest-fallback/pytest.py
index 6e124db418..6e124db418 100644
--- a/lib/spack/external/pytest.py
+++ b/lib/spack/external/pytest-fallback/pytest.py
diff --git a/lib/spack/spack/cmd/unit_test.py b/lib/spack/spack/cmd/unit_test.py
index ce4e2cbdbb..0f117f2d7a 100644
--- a/lib/spack/spack/cmd/unit_test.py
+++ b/lib/spack/spack/cmd/unit_test.py
@@ -7,14 +7,19 @@ from __future__ import division, print_function
import argparse
import collections
+import os.path
import re
import sys
-import pytest
+try:
+ import pytest
+except ImportError:
+ pytest = None # type: ignore
+
from six import StringIO
+import llnl.util.filesystem
import llnl.util.tty.color as color
-from llnl.util.filesystem import working_dir
from llnl.util.tty.colify import colify
import spack.paths
@@ -67,7 +72,25 @@ def setup_parser(subparser):
def do_list(args, extra_args):
"""Print a lists of tests than what pytest offers."""
- # Run test collection and get the tree out.
+ def colorize(c, prefix):
+ if isinstance(prefix, tuple):
+ return "::".join(
+ color.colorize("@%s{%s}" % (c, p))
+ for p in prefix if p != "()"
+ )
+ return color.colorize("@%s{%s}" % (c, prefix))
+
+ # To list the files we just need to inspect the filesystem,
+ # which doesn't need to wait for pytest collection and doesn't
+ # require parsing pytest output
+ files = llnl.util.filesystem.find(
+ root=spack.paths.test_path, files='*.py', recursive=True
+ )
+ files = [
+ os.path.relpath(f, start=spack.paths.spack_root)
+ for f in files if not f.endswith(('conftest.py', '__init__.py'))
+ ]
+
old_output = sys.stdout
try:
sys.stdout = output = StringIO()
@@ -76,12 +99,13 @@ def do_list(args, extra_args):
sys.stdout = old_output
lines = output.getvalue().split('\n')
- tests = collections.defaultdict(lambda: set())
- prefix = []
+ tests = collections.defaultdict(set)
# collect tests into sections
+ node_regexp = re.compile(r"(\s*)<([^ ]*) ['\"]?([^']*)['\"]?>")
+ key_parts, name_parts = [], []
for line in lines:
- match = re.match(r"(\s*)<([^ ]*) '([^']*)'", line)
+ match = node_regexp.match(line)
if not match:
continue
indent, nodetype, name = match.groups()
@@ -90,25 +114,31 @@ def do_list(args, extra_args):
if "[" in name:
name = name[:name.index("[")]
- depth = len(indent) // 2
-
- if nodetype.endswith("Function"):
- key = tuple(prefix)
- tests[key].add(name)
- else:
- prefix = prefix[:depth]
- prefix.append(name)
-
- def colorize(c, prefix):
- if isinstance(prefix, tuple):
- return "::".join(
- color.colorize("@%s{%s}" % (c, p))
- for p in prefix if p != "()"
- )
- return color.colorize("@%s{%s}" % (c, prefix))
+ len_indent = len(indent)
+ if os.path.isabs(name):
+ name = os.path.relpath(name, start=spack.paths.spack_root)
+
+ item = (len_indent, name, nodetype)
+
+ # Reduce the parts to the scopes that are of interest
+ name_parts = [x for x in name_parts if x[0] < len_indent]
+ key_parts = [x for x in key_parts if x[0] < len_indent]
+
+ # From version 3.X to version 6.X the output format
+ # changed a lot in pytest, and probably will change
+ # in the future - so this manipulation might be fragile
+ if nodetype.lower() == 'function':
+ name_parts.append(item)
+ key_end = os.path.join(*[x[1] for x in key_parts])
+ key = next(f for f in files if f.endswith(key_end))
+ tests[key].add(tuple(x[1] for x in name_parts))
+ elif nodetype.lower() == 'class':
+ name_parts.append(item)
+ elif nodetype.lower() in ('package', 'module'):
+ key_parts.append(item)
if args.list == "list":
- files = set(prefix[0] for prefix in tests)
+ files = set(tests.keys())
color_files = [colorize("B", file) for file in sorted(files)]
colify(color_files)
@@ -144,6 +174,14 @@ def add_back_pytest_args(args, unknown_args):
def unit_test(parser, args, unknown_args):
+ global pytest
+ if pytest is None:
+ vendored_pytest_dir = os.path.join(
+ spack.paths.external_path, 'pytest-fallback'
+ )
+ sys.path.append(vendored_pytest_dir)
+ import pytest
+
if args.pytest_help:
# make the pytest.main help output more accurate
sys.argv[0] = 'spack unit-test'
@@ -161,7 +199,7 @@ def unit_test(parser, args, unknown_args):
pytest_root = spack.extensions.path_for_extension(target, *extensions)
# pytest.ini lives in the root of the spack repository.
- with working_dir(pytest_root):
+ with llnl.util.filesystem.working_dir(pytest_root):
if args.list:
do_list(args, pytest_args)
return
diff --git a/lib/spack/spack/test/cmd/unit_test.py b/lib/spack/spack/test/cmd/unit_test.py
index 1a273ff244..9811bdbfbd 100644
--- a/lib/spack/spack/test/cmd/unit_test.py
+++ b/lib/spack/spack/test/cmd/unit_test.py
@@ -22,7 +22,10 @@ def test_list_with_pytest_arg():
def test_list_with_keywords():
- output = spack_test('--list', '-k', 'cmd/unit_test.py')
+ # Here we removed querying with a "/" to separate directories
+ # since the behavior is inconsistent across different pytest
+ # versions, see https://stackoverflow.com/a/48814787/771663
+ output = spack_test('--list', '-k', 'unit_test.py')
assert output.strip() == cmd_test_py
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 9a6dc0b13b..d502cf1db1 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -430,8 +430,14 @@ def _skip_if_missing_executables(request):
"""Permits to mark tests with 'require_executables' and skip the
tests if the executables passed as arguments are not found.
"""
- if request.node.get_marker('requires_executables'):
- required_execs = request.node.get_marker('requires_executables').args
+ if hasattr(request.node, 'get_marker'):
+ # TODO: Remove the deprecated API as soon as we drop support for Python 2.6
+ marker = request.node.get_marker('requires_executables')
+ else:
+ marker = request.node.get_closest_marker('requires_executables')
+
+ if marker:
+ required_execs = marker.args
missing_execs = [
x for x in required_execs if spack.util.executable.which(x) is None
]
@@ -1453,7 +1459,7 @@ def invalid_spec(request):
return request.param
-@pytest.fixture("module")
+@pytest.fixture(scope='module')
def mock_test_repo(tmpdir_factory):
"""Create an empty repository."""
repo_namespace = 'mock_test_repo'