From 1427ddaa59df661e9fe3f4b8939eb92fd1b83a88 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Sat, 10 Sep 2022 15:25:44 +0200 Subject: ci: restore coverage computation (#32585) * ci: restore coverage computation * Mark "test_foreground_background" as xfail * Mark "test_foreground_background_output" as xfail * Make number of processes explicit, remove verbosity on linux * Run coverage on just 3 Python jobs for linux * Run coverage on just 3 Python jobs for linux * Run coverage on just 2 Python jobs for linux * Add back verbose, since before we didn't encounter the xdist internal error * Reduce the workers to 2 * Try to use command line --- share/spack/qa/run-unit-tests | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'share') 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 -- cgit v1.2.3-60-g2f50