summaryrefslogtreecommitdiff
path: root/share/spack/qa/run-unit-tests
diff options
context:
space:
mode:
Diffstat (limited to 'share/spack/qa/run-unit-tests')
-rwxr-xr-xshare/spack/qa/run-unit-tests22
1 files changed, 17 insertions, 5 deletions
diff --git a/share/spack/qa/run-unit-tests b/share/spack/qa/run-unit-tests
index da8334f76b..2de6b6101d 100755
--- a/share/spack/qa/run-unit-tests
+++ b/share/spack/qa/run-unit-tests
@@ -56,13 +56,25 @@ if python -m pytest --trace-config 2>&1 | grep xdist; then
export PYTEST_ADDOPTS="$PYTEST_ADDOPTS --dist loadfile --tx '${SPACK_TEST_PARALLEL:=3}*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python'"
fi
-$coverage_run $(which spack) unit-test -x --verbose
+# We are running pytest-cov after the addition of pytest-xdist, since it integrates
+# other pugins for pytest automatically. We still need to use "coverage" explicitly
+# for the commands above.
+#
+# There is a need to pass the configuration file explicitly due to a bug:
+# https://github.com/pytest-dev/pytest-cov/issues/243
+# https://github.com/pytest-dev/pytest-cov/issues/237
+# where it seems that otherwise the configuration file might not be located by subprocesses
+# in some, not better specified, cases.
+if [[ "$UNIT_TEST_COVERAGE" == "true" ]]; then
+ $(which spack) unit-test -x --verbose --cov --cov-config=pyproject.toml
+else
+ $(which spack) unit-test -x --verbose
+fi
+
+
bash "$QA_DIR/test-env-cfg.sh"
# Delete the symlink going from ./lib/spack/docs/_spack_root back to
# the initial directory, since it causes ELOOP errors with codecov/actions@2
-if [[ "$COVERAGE" == "true" ]]; then
- rm lib/spack/docs/_spack_root
-fi
-
+rm lib/spack/docs/_spack_root