Caught by check-code.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Lint Skipped |
Unit Tests Skipped |
def sorttests(testdescs, previoustimes, shuffle=False): | def sorttests(testdescs, previoustimes, shuffle=False): | ||||
"""Do an in-place sort of tests.""" | """Do an in-place sort of tests.""" | ||||
if shuffle: | if shuffle: | ||||
random.shuffle(testdescs) | random.shuffle(testdescs) | ||||
return | return | ||||
if previoustimes: | if previoustimes: | ||||
def sortkey(f): | def sortkey(f): | ||||
f = f['path'] | f = f['path'] | ||||
if f in previoustimes: | if f in previoustimes: | ||||
# Use most recent time as estimate | # Use most recent time as estimate | ||||
return -previoustimes[f][-1] | return -previoustimes[f][-1] | ||||
else: | else: | ||||
# Default to a rather arbitrary value of 1 second for new tests | # Default to a rather arbitrary value of 1 second for new tests | ||||
return -1.0 | return -1.0 | ||||
else: | else: | ||||
# keywords for slow tests | # keywords for slow tests | ||||
slow = {b'svn': 10, | slow = {b'svn': 10, | ||||
b'cvs': 10, | b'cvs': 10, | ||||
b'hghave': 10, | b'hghave': 10, | ||||
b'largefiles-update': 10, | b'largefiles-update': 10, | ||||
b'run-tests': 10, | b'run-tests': 10, | ||||
b'corruption': 10, | b'corruption': 10, | ||||
if self.options.outputdir: | if self.options.outputdir: | ||||
self._outputdir = canonpath(_bytespath(self.options.outputdir)) | self._outputdir = canonpath(_bytespath(self.options.outputdir)) | ||||
else: | else: | ||||
self._outputdir = self._testdir | self._outputdir = self._testdir | ||||
if testdescs and pathname: | if testdescs and pathname: | ||||
self._outputdir = os.path.join(self._outputdir, pathname) | self._outputdir = os.path.join(self._outputdir, pathname) | ||||
previoustimes = {} | previoustimes = {} | ||||
if self.options.order_by_runtime: | if self.options.order_by_runtime: | ||||
previoustimes = dict(loadtimes(self._outputdir)) | previoustimes = dict(loadtimes(self._outputdir)) | ||||
sorttests(testdescs, previoustimes, shuffle=self.options.random) | sorttests(testdescs, previoustimes, shuffle=self.options.random) | ||||
if 'PYTHONHASHSEED' not in os.environ: | if 'PYTHONHASHSEED' not in os.environ: | ||||
# use a random python hash seed all the time | # use a random python hash seed all the time | ||||
# we do the randomness ourself to know what seed is used | # we do the randomness ourself to know what seed is used | ||||
os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) | os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) | ||||
if self.options.tmpdir: | if self.options.tmpdir: |