[PATCH] run-tests: try to provide a test.env file RFC
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Jan 17 18:08:21 UTC 2016
On 12/22/2015 03:33 AM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1450782416 0
> # Tue Dec 22 11:06:56 2015 +0000
> # Node ID 34293f86ef44d094aeca7d933c67d0f8bca8106e
> # Parent 3dea4eae4eebac11741f0c1dc5dcd9c88d8f4554
> run-tests: try to provide a test.env file RFC
>
> This is a step to providing an environment file that people can use
> to reproduce a failing test environment.
The idea seems interresting.
> --
> The Windows side isn't tested.
> Long term, it'd be helpful if this included code or instructions
> to empty the environment too...
Can we get some documentation and basic testing for this?
I would like to make sure it does not silently broke and that people are
able to find it.
We also probably want a .hgignore rules for it.
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -685,6 +685,18 @@
> if self._keeptmpdir:
> log('\nKeeping testtmp dir: %s\nKeeping threadtmp dir: %s' %
> (self._testtmp, self._threadtmp))
> + env = self._getenv()
> + quote = re.compile('"')
> + def format(k, v):
> + return 'export %s="%s"\n' % (k, quote.sub('\\"', v))
> + if os.name == 'nt':
> + amp = re.compile('&')
> + def format(k, v):
> + return 'set %s=%s\r\n' % (k, amp.sub('^&', v))
> + f = open(os.path.join(self._threadtmp, 'test.env'), 'wb')
> + for k, v in env.iteritems():
> + f.write(format(k, v))
> + f.close()
> else:
> shutil.rmtree(self._testtmp, True)
> shutil.rmtree(self._threadtmp, True)
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list