--- a/tests/run-tests.py Sun Apr 20 10:00:59 2014 -0700
+++ b/tests/run-tests.py Sun Apr 20 10:03:08 2014 -0700
@@ -1019,6 +1019,25 @@
return self._run(tests)
def _run(self, tests):
+ if self.options.random:
+ random.shuffle(tests)
+ else:
+ # keywords for slow tests
+ slow = 'svn gendoc check-code-hg'.split()
+ def sortkey(f):
+ # run largest tests first, as they tend to take the longest
+ try:
+ val = -os.stat(f).st_size
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ return -1e9 # file does not exist, tell early
+ for kw in slow:
+ if kw in f:
+ val *= 10
+ return val
+ tests.sort(key=sortkey)
+
self.testdir = os.environ['TESTDIR'] = os.getcwd()
if 'PYTHONHASHSEED' not in os.environ:
@@ -1444,25 +1463,6 @@
tests = runner.findtests(args)
- if options.random:
- random.shuffle(tests)
- else:
- # keywords for slow tests
- slow = 'svn gendoc check-code-hg'.split()
- def sortkey(f):
- # run largest tests first, as they tend to take the longest
- try:
- val = -os.stat(f).st_size
- except OSError, e:
- if e.errno != errno.ENOENT:
- raise
- return -1e9 # file does not exist, tell early
- for kw in slow:
- if kw in f:
- val *= 10
- return val
- tests.sort(key=sortkey)
-
return runner.run(tests)
if __name__ == '__main__':