summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2018-08-30 15:31:21 (GMT)
committerMats Wichmann <mats@linux.com>2018-08-30 15:31:21 (GMT)
commitc487700ccd4cae873170b812c2f201f1400d8dea (patch)
tree51a6f1a89ae86aa4ebf375e6d419daabd17359a1
parent0357e3670d475fbd0a1b56b6fb05f78e92ad8485 (diff)
downloadSCons-c487700ccd4cae873170b812c2f201f1400d8dea.zip
SCons-c487700ccd4cae873170b812c2f201f1400d8dea.tar.gz
SCons-c487700ccd4cae873170b812c2f201f1400d8dea.tar.bz2
Do not use time.clock for Py3 in runtest
time.clock is deprecated since Python 3.3 and will be removed in Python 3.8. 3.7 started issuing DeprecationWarning, which fails about 16 tests in AppVeyor CI (and running manually), since the warning appears in stderr stream and so real vs expected does not match any longer. Arguably the tests could be fixed to do a different check (contains rather than exactly-equal), but a change needs to be made anyway. use time.perf_counter as the time function for Python 3. This works for Windows and non-Windows; however since this function did not exist in 2.7 (added for 3.3), the Py2 case is left, which selects between time.clock and time.time depending on OS. Note this addresses runtest.py, but not code in bench/, which need attention also. Suggest that be a separate change since it's not failing tests. Signed-off-by: Mats Wichmann <mats@linux.com>
-rwxr-xr-xruntest.py12
-rw-r--r--src/CHANGES.txt3
2 files changed, 11 insertions, 4 deletions
diff --git a/runtest.py b/runtest.py
index 293e4ca..1cac45b 100755
--- a/runtest.py
+++ b/runtest.py
@@ -95,11 +95,12 @@ import time
import threading
try: # python3
from queue import Queue
+ PY3=True
except ImportError as e: # python2
from Queue import Queue
+ PY3=False
import subprocess
-
cwd = os.getcwd()
baseline = 0
@@ -770,10 +771,13 @@ os.environ["python_executable"] = python
# but time.time() does a better job on Linux systems, so let that be
# the non-Windows default.
-if sys.platform == 'win32':
- time_func = time.clock
+if PY3:
+ time_func = time.perf_counter
else:
- time_func = time.time
+ if sys.platform == 'win32':
+ time_func = time.clock
+ else:
+ time_func = time.time
if print_times:
print_time_func = lambda fmt, time: sys.stdout.write(fmt % time)
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index ab15214..27fe66a 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -123,6 +123,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
- fix must_contain tests for py3
- one swig test now checks for Python.h instead of failing
- if test opens os.devnull, register with atexit so file opens do not leak.
+ - for py3, use time.perf_counter instead of depr time.clock, which is
+ used in win32 case for py2. py37 depr warnings were failing a bunch
+ of tests on windows since warn messes up expected stderr.
From Hao Wu
- typo in customized decider example in user guide