[PATCH 2 of 3 V2] runtests: rename test description dict to testdesc
Jun Wu
quark at fb.com
Wed May 17 11:23:28 EDT 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1494994660 25200
# Tue May 16 21:17:40 2017 -0700
# Node ID 1bc740f63f2d8279ae1b12132b932878c9e2e26d
# Parent 8fb560751eb7e72e87a9c49dee66d2de8bbcfe8e
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 1bc740f63f2d
runtests: rename test description dict to testdesc
Previously the word "test" was used for both a Test instance and a path or
test dict. This patch renames them so it's clear that "testdesc" is the
dict, and "test" is the instance.
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2068,9 +2068,9 @@ class TestRunner(object):
self._checktools()
- tests = self.findtests(args)
+ testdescs = self.findtests(args)
if options.profile_runner:
import statprof
statprof.start()
- result = self._run(tests)
+ result = self._run(testdescs)
if options.profile_runner:
statprof.stop()
@@ -2081,7 +2081,7 @@ class TestRunner(object):
os.umask(oldmask)
- def _run(self, tests):
+ def _run(self, testdescs):
if self.options.random:
- random.shuffle(tests)
+ random.shuffle(testdescs)
else:
# keywords for slow tests
@@ -2119,5 +2119,5 @@ class TestRunner(object):
perf[f] = val / 1000.0
return perf[f]
- tests.sort(key=sortkey)
+ testdescs.sort(key=sortkey)
self._testdir = osenvironb[b'TESTDIR'] = getattr(
@@ -2249,5 +2249,5 @@ class TestRunner(object):
try:
- return self._runtests(tests) or 0
+ return self._runtests(testdescs) or 0
finally:
time.sleep(.1)
@@ -2273,5 +2273,5 @@ class TestRunner(object):
and (t.endswith(b'.py') or t.endswith(b'.t'))]
- def _runtests(self, tests):
+ def _runtests(self, testdescs):
def _reloadtest(test, i):
# convert a test back to its description dict
@@ -2290,14 +2290,14 @@ class TestRunner(object):
if self.options.restart:
- orig = list(tests)
- while tests:
- if os.path.exists(tests['path'][0] + ".err"):
+ orig = list(testdescs)
+ while testdescs:
+ if os.path.exists(testdescs[0]['path'] + ".err"):
break
- tests.pop(0)
- if not tests:
+ testdescs.pop(0)
+ if not testdescs:
print("running all tests")
- tests = orig
+ testdescs = orig
- tests = [self._gettest(t, i) for i, t in enumerate(tests)]
+ tests = [self._gettest(d, i) for i, d in enumerate(testdescs)]
failed = False
@@ -2357,5 +2357,5 @@ class TestRunner(object):
return port
- def _gettest(self, test, count):
+ def _gettest(self, testdesc, count):
"""Obtain a Test by looking at its filename.
@@ -2363,5 +2363,5 @@ class TestRunner(object):
map to a known type.
"""
- path = test['path']
+ path = testdesc['path']
lctest = path.lower()
testcls = Test
More information about the Mercurial-devel
mailing list