writing tests for an extension

Patrick Mézard pmezard at gmail.com
Fri Dec 5 06:28:45 CST 2008


Dov Feldstern a écrit :
> Hi!
> 
> I see that tests of an extension need to add the extension to the hgrc, like so:
> 
> [extensions]
> convert=
> 
> However, that only works if the extension is placed within the the hgext 
> directory; otherwise, it's necessary to provide a full path to the extension's 
> location. But I don't want to hard code that into the tests. I also want this to 
> work, say, with a binary installation on Windows, where there may not even be an 
> hgext directory (is that true?).
> 
> Any ideas on how to deal with this?

It works if you run the tests from the extension directory. For instance, the forest extension repository contains the extension file and a single test file. The test is run with:

$ python ../your-hg-repo/tests/run-tests.py test-forest

and the test itself registers the extension like:

"""
echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
echo "forest=" >> $HGRCPATH
"""

--
Patrick Mézard


More information about the Mercurial-devel mailing list