comparison tests/common.py @ 7:eac8be119d81

tests: rearrange tests and use nosetests - provide package setup/teardown methods that fixes the environment - introduce a basetest that initializes a repository in a temp dir
author Idan Kamara <idankk86@gmail.com>
date Sat, 23 Jul 2011 22:55:39 +0300
parents
children 3d413c54e048
comparison
equal deleted inserted replaced
6:96f8c5095e2e 7:eac8be119d81
1 import os, sys, tempfile, shutil
2 import unittest
3
4 import hglib
5
6 class basetest(unittest.TestCase):
7 def setUp(self):
8 self._testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
9 os.path.join(os.environ["HGTMP"], self.__class__.__name__)
10
11 os.mkdir(self._testtmp)
12 os.chdir(self._testtmp)
13 # until we can run norepo commands in the cmdserver
14 os.system('hg init')
15 self.client = hglib.open()
16
17 def tearDown(self):
18 shutil.rmtree(self._testtmp)
19
20 def append(self, path, *args):
21 f = open(path, 'a')
22 for a in args:
23 f.write(str(a))
24 f.close()