diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2021-06-23 13:56:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 07:56:07 -0400 |
commit | 1bccd866ae59ea3ea99585bc1788c1146391bb28 (patch) | |
tree | 5cccc6df2296edb4d22bb4aaa1efff1505d9334f /lib | |
parent | 97f0c3ccd9f0a40896998a7580150a514ec3bc37 (diff) | |
download | spack-1bccd866ae59ea3ea99585bc1788c1146391bb28.tar.gz spack-1bccd866ae59ea3ea99585bc1788c1146391bb28.tar.bz2 spack-1bccd866ae59ea3ea99585bc1788c1146391bb28.tar.xz spack-1bccd866ae59ea3ea99585bc1788c1146391bb28.zip |
Fix broken CI for package only PRs, make dateutil not strictly required (#24484)
* Force the Python interpreter with an env variable
This commit forces the Python interpreter with an
environment variable, to ensure that the Python set
by the "setup-python" action is the one being used.
Due to the policy adopted by Spack to prefer python3
over python we may end up picking a Python 3.X
interpreter where Python 2.7 was meant to be used.
* Revert "Update conftest.py (#24473)"
This reverts commit 477c8ce8205ec149fa897c9d83e530815c978d8b.
* Make python-dateutil a soft dependency for unit tests
Before #23212 people could clone spack and run
```
spack unit-tests
```
while now this is not possible, since python-dateutil is
a required but not vendored dependency. This change makes
it not a hard requirement, i.e. it will be used if found
in the current interpreter.
* Workaround mypy complaint
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/conftest.py | 11 |
1 files changed, 5 insertions, 6 deletions
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 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 |