[PATCH hglib] tests: use hglib.init in setUp
Idan Kamara
idankk86 at gmail.com
Sat Oct 15 13:24:29 CDT 2011
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1318703052 -7200
# Node ID 5cf6af9a9411c52bb13e13738f35e82e556f1c6b
# Parent 37307caccf54792423831ebda673246636730cfe
tests: use hglib.init in setUp
diff --git a/tests/common.py b/tests/common.py
--- a/tests/common.py
+++ b/tests/common.py
@@ -17,20 +17,24 @@
self._testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
os.path.join(os.environ["HGTMP"], self.__class__.__name__)
- self.clients = []
- self._oldopen = hglib.open
- hglib.open = resultappender(self.clients)(hglib.open)
-
os.mkdir(self._testtmp)
os.chdir(self._testtmp)
- # until we can run norepo commands in the cmdserver
- os.system('hg init')
- self.client = hglib.open()
+
+ self.clients = []
+ self._oldopen, self._oldinit = hglib.open, hglib.init
+ hglib.open = resultappender(self.clients)(hglib.open)
+ hglib.init = resultappender(self.clients)(hglib.init)
+
+ try:
+ self.client = hglib.init()
+ except:
+ hglib.open, hglib.init = self._oldopen, self._oldinit
+ raise
def tearDown(self):
# on Windows we cannot rmtree before closing all instances because of used
# files
- hglib.open = self._oldopen
+ hglib.open, hglib.init = self._oldopen, self._oldinit
for client in self.clients:
if client.server is not None:
client.close()
More information about the Mercurial-devel
mailing list