summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-02-23 08:16:39 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-02-23 10:04:16 +0100
commit605cc2143259e07ecd7df7aad79a37197fd011a2 (patch)
tree0536f909e26b79253330a1215e98772d2195a3ab
parentadf1223d5f7cdcf0c7c075bfe9c3b54e3e8a85e3 (diff)
downloadcython-605cc2143259e07ecd7df7aad79a37197fd011a2.tar.gz
Simplify some Py2 checks in the test runner.
-rwxr-xr-xruntests.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtests.py b/runtests.py
index af7312490..f98c17bf8 100755
--- a/runtests.py
+++ b/runtests.py
@@ -29,6 +29,7 @@ try:
except (ImportError, AttributeError):
IS_CPYTHON = True
IS_PYPY = False
+IS_PY2 = sys.version_info[0] < 3
from io import open as io_open
try:
@@ -1913,7 +1914,7 @@ class ShardExcludeSelector(object):
self.shard_num = shard_num
self.shard_count = shard_count
- def __call__(self, testname, tags=None, _hash=zlib.crc32, _is_py2=sys.version_info[0] < 3):
+ def __call__(self, testname, tags=None, _hash=zlib.crc32, _is_py2=IS_PY2):
# Cannot use simple hash() here as shard processes might use different hash seeds.
# CRC32 is fast and simple, but might return negative values in Py2.
hashval = _hash(testname) & 0x7fffffff if _is_py2 else _hash(testname.encode())
@@ -2495,10 +2496,7 @@ def runtests(options, cmd_args, coverage=None):
else:
text_runner_options = {}
if options.failfast:
- if sys.version_info < (2, 7):
- sys.stderr.write("--failfast not supported with Python < 2.7\n")
- else:
- text_runner_options['failfast'] = True
+ text_runner_options['failfast'] = True
test_runner = unittest.TextTestRunner(verbosity=options.verbosity, **text_runner_options)
if options.pyximport_py: