[PATCH RFC, V3] run-tests: use hghave.py
Adrian Buehlmann
adrian at cadifra.com
Mon Jun 18 18:07:07 CDT 2012
On 2012-06-19 00:38, Mads Kiilerich wrote:
> Adrian Buehlmann wrote, On 06/19/2012 12:00 AM:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1340041060 -7200
>> # Node ID 94a761427a57b21e47ed9bdc3293337cb2885c55
>> # Parent 132ea1736751cb02b16992cf421e7de8bad888a1
>> run-tests: use hghave.py
>>
>> Eliminates the start of a subprocess for #if requirements checking.
>>
>> The has_xxx functions in hghave.py now get the path where they should do their
>> check in.
>
> Thanks, this looks good, but testing revealed a couple of show stoppers.
Wow. That was a fast response. Thanks.
>> diff --git a/tests/hghave.py b/tests/hghave.py
>> --- a/tests/hghave.py
>> +++ b/tests/hghave.py
>> @@ -37,30 +37,30 @@
>> except ImportError:
>> return False
>>
>> -def has_cvs():
>> +def has_cvs(wd):
>> re = r'Concurrent Versions System.*?server'
>> return matchoutput('cvs --version 2>&1', re) and not has_msys()
>
> This way of disabling cvs on msys is an ugly hack that probably should
> be removed, but the way it is now it lacks a wd, and test-hghave.t and
> the cvs tests will thus fail when cvs is available.
Yep. I missed that one.
>> @@ -118,30 +118,30 @@
>> except OSError:
>> return False
>>
>> -def has_cacheable_fs():
>> +def has_cacheable_fs(wd):
>> from mercurial import util
>
> hghave is run in the test environment where PYTHONPATH is set so the
> right mercurial can be imported. But PYTHONPATH is probably not set
> correctly when run-tests is invoked, so when imported in run-tests it
> will use the wrong mercurial or fail to import it.
Right. I noticed that I had to use (on Windows, all on one line):
$ PATH="/mingw/bin:/bin:/c/python:/c/cygwin/bin"
PYTHONPATH="..:/c/python/lib:/c/Python/DLLs" ./run-tests.py --local
Requiring .. there is most likely not acceptable.
And on Ubuntu it perhaps indeed has picked up a globally installed
mercurial package. Pretty bad.
>> - fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
>> + fd, path = tempfile.mkstemp(dir=wd, prefix=tempprefix)
>> os.close(fd)
>> try:
>> return util.cachestat(path).cacheable()
>> finally:
>> os.remove(path)
>>
>
> /Mads
>
>
More information about the Mercurial-devel
mailing list