Mercurial > hg
view tests/revnamesext.py @ 35450:e31773898197
run-tests: use context managers for file descriptors
I've seen the following error a few times recently when running the tests with
`yes | ./run-tests.py --local -j9 -i`:
Errored test-add.t: Traceback (most recent call last):
File "./run-tests.py", line 821, in run
self.runTest()
File "./run-tests.py", line 910, in runTest
if self._result.addOutputMismatch(self, ret, out, self._refout):
File "./run-tests.py", line 1774, in addOutputMismatch
rename(test.errpath, test.path)
File "./run-tests.py", line 571, in rename
os.remove(src)
WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: 'c:\\Users\\Matt\\projects\\hg\\tests\\test-add.t.err'
This change doesn't fix the problem, but it seems like a simple enough
improvement.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 17 Dec 2017 14:06:49 -0500 |
parents | 46fa46608ca5 |
children | 086fc71fbb09 |
line wrap: on
line source
# Dummy extension to define a namespace containing revision names from __future__ import absolute_import from mercurial import ( namespaces, ) def reposetup(ui, repo): names = {'r%d' % rev: repo[rev].node() for rev in repo} namemap = lambda r, name: names.get(name) nodemap = lambda r, node: ['r%d' % repo[node].rev()] ns = namespaces.namespace('revnames', templatename='revname', logname='revname', listnames=lambda r: names.keys(), namemap=namemap, nodemap=nodemap) repo.names.addnamespace(ns)