diff --git a/easybuild/tools/systemtools.py b/easybuild/tools/systemtools.py index 2d58ae1f55..19b3fd4c1f 100644 --- a/easybuild/tools/systemtools.py +++ b/easybuild/tools/systemtools.py @@ -1240,17 +1240,13 @@ def check_python_version(): python_ver = '%d.%d' % (python_maj_ver, python_min_ver) _log.info("Found Python version %s", python_ver) - if python_maj_ver == 2: - if python_min_ver < 7: - raise EasyBuildError("Python 2.7 is required when using Python 2, found Python %s", python_ver) - else: - _log.info("Running EasyBuild with Python 2 (version %s)", python_ver) - - elif python_maj_ver == 3: - if python_min_ver < 5: - raise EasyBuildError("Python 3.5 or higher is required when using Python 3, found Python %s", python_ver) + if python_maj_ver == 3: + if python_min_ver < 6: + raise EasyBuildError("Python 3.6 or higher is required, found Python %s", python_ver) else: _log.info("Running EasyBuild with Python 3 (version %s)", python_ver) + elif python_maj_ver < 3: + raise EasyBuildError("EasyBuild is not compatible with Python %s", python_ver) else: raise EasyBuildError("EasyBuild is not compatible (yet) with Python %s", python_ver) diff --git a/test/framework/systemtools.py b/test/framework/systemtools.py index 279fda6cbc..e546d87b78 100644 --- a/test/framework/systemtools.py +++ b/test/framework/systemtools.py @@ -867,19 +867,23 @@ def mock_python_ver(py_maj_ver, py_min_ver): # mock running with different Python versions mock_python_ver(1, 4) - error_pattern = r"EasyBuild is not compatible \(yet\) with Python 1.4" + error_pattern = r"EasyBuild is not compatible with Python 1.4" self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version) mock_python_ver(4, 0) error_pattern = r"EasyBuild is not compatible \(yet\) with Python 4.0" self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version) - mock_python_ver(2, 6) - error_pattern = r"Python 2.7 is required when using Python 2, found Python 2.6" + mock_python_ver(2, 7) + error_pattern = r"EasyBuild is not compatible with Python 2.7" + self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version) + + mock_python_ver(3, 5) + error_pattern = r"Python 3.6 or higher is required, found Python 3.5" self.assertErrorRegex(EasyBuildError, error_pattern, check_python_version) # no problems when running with a supported Python version - for pyver in [(2, 7), (3, 5), (3, 6), (3, 7)]: + for pyver in [(3, 6), (3, 7), (3, 11)]: mock_python_ver(*pyver) self.assertEqual(check_python_version(), pyver) diff --git a/test/framework/toolchain.py b/test/framework/toolchain.py index a07e6523b1..042d366acd 100644 --- a/test/framework/toolchain.py +++ b/test/framework/toolchain.py @@ -2988,8 +2988,7 @@ def prep(): # warning is printed and $TMPDIR is set to shorter path if existing $TMPDIR is too long os.environ['TMPDIR'] = long_tmpdir tc, stdout, stderr = prep() - # basename of tmpdir will be 6 chars in Python 2, 8 chars in Python 3 - regex = re.compile(r"^WARNING: Long \$TMPDIR .* problems with OpenMPI 2.x, using shorter path: /tmp/.{6,8}$") + regex = re.compile(r"^WARNING: Long \$TMPDIR .* problems with OpenMPI 2.x, using shorter path: /tmp/.{8}$") self.assertTrue(regex.match(stderr), "Pattern '%s' found in: %s" % (regex.pattern, stderr)) # new $TMPDIR should be /tmp/xxxxxx