diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 6d5901edd1..726c56e617 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -156,6 +156,8 @@ jobs: make -C ${KCOV_ROOT}/build && sudo make -C ${KCOV_ROOT}/build install - name: Bootstrap clingo from sources if: ${{ matrix.concretizer == 'clingo' }} + env: + SPACK_PYTHON: python run: | . share/spack/setup-env.sh spack external find --not-buildable cmake bison @@ -163,6 +165,7 @@ jobs: - name: Run unit tests (full suite with coverage) if: ${{ needs.changes.outputs.with_coverage == 'true' }} env: + SPACK_PYTHON: python COVERAGE: true SPACK_TEST_SOLVER: ${{ matrix.concretizer }} run: | @@ -172,6 +175,7 @@ jobs: - name: Run unit tests (reduced suite without coverage) if: ${{ needs.changes.outputs.with_coverage == 'false' }} env: + SPACK_PYTHON: python ONLY_PACKAGES: true SPACK_TEST_SOLVER: ${{ matrix.concretizer }} run: | diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 8d0ff77bb9..2443d0edf0 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -12,20 +12,19 @@ import os.path import re import shutil -import sys import tempfile import xml.etree.ElementTree -if sys.version_info >= (3,): +try: # CVS outputs dates in different formats on different systems. We are using # the dateutil package to parse these dates. This package does not exist - # for Python 2.x. That means that we cannot test checkouts "by date" for + # for Python <2.7. That means that we cannot test checkouts "by date" for # CVS respositories. (We can still use CVS repos with all features, only # our tests break.) from dateutil.parser import parse as parse_date -else: - def parse_date(string): - pytest.skip("dateutil package not available for Python 2.6") +except ImportError: + def parse_date(string): # type: ignore + pytest.skip("dateutil package not available") import py import pytest