[PATCH 1 of 9 hglib] tests: use an hgrc file with some defaults when running tests
Idan Kamara
idankk86 at gmail.com
Mon Aug 15 14:20:42 CDT 2011
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1313435574 -10800
# Node ID 0d3df58fe89e19e081920bd5f85d4f41f221dc5f
# Parent 6790dab2c69b37f4b3af3fae0c10bab2b2691b80
tests: use an hgrc file with some defaults when running tests
taken from Mercurial's run-tests.py
diff -r 6790dab2c69b -r 0d3df58fe89e tests/__init__.py
--- a/tests/__init__.py Sun Aug 14 21:42:23 2011 +0300
+++ b/tests/__init__.py Mon Aug 15 22:12:54 2011 +0300
@@ -14,8 +14,9 @@
os.environ["HGUSER"] = "test"
os.environ["HGENCODING"] = "ascii"
os.environ["HGENCODINGMODE"] = "strict"
- tmpdir = tempfile.mkdtemp('', 'python-hglib.')
- os.environ["HGTMP"] = os.path.realpath(tmpdir)
+ tmpdir = os.path.realpath(tempfile.mkdtemp('', 'python-hglib.'))
+ os.environ["HGTMP"] = tmpdir
+ os.environ["HGRCPATH"] = os.path.join(tmpdir, '.hgrc')
def tearDown(self):
shutil.rmtree(os.environ["HGTMP"])
diff -r 6790dab2c69b -r 0d3df58fe89e tests/common.py
--- a/tests/common.py Sun Aug 14 21:42:23 2011 +0300
+++ b/tests/common.py Mon Aug 15 22:12:54 2011 +0300
@@ -10,6 +10,16 @@
os.mkdir(self._testtmp)
os.chdir(self._testtmp)
+
+ hgrc = open(os.environ['HGRCPATH'], 'w+')
+ hgrc.write('[ui]\n')
+ hgrc.write('slash = True\n')
+ hgrc.write('[defaults]\n')
+ hgrc.write('backout = -d "0 0"\n')
+ hgrc.write('commit = -d "0 0"\n')
+ hgrc.write('tag = -d "0 0"\n')
+ hgrc.close()
+
# until we can run norepo commands in the cmdserver
os.system('hg init')
self.client = hglib.open()
More information about the Mercurial-devel
mailing list