annotate tests/common.py @ 11:0549d00a617d

client: add missing options to branch() and add some more tests
author Idan Kamara <idankk86@gmail.com>
date Wed, 10 Aug 2011 00:21:05 +0300
parents eac8be119d81
children 3d413c54e048
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import os, sys, tempfile, shutil
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2 import unittest
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 import hglib
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 class basetest(unittest.TestCase):
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 def setUp(self):
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8 self._testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 os.path.join(os.environ["HGTMP"], self.__class__.__name__)
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 os.mkdir(self._testtmp)
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 os.chdir(self._testtmp)
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 # until we can run norepo commands in the cmdserver
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 os.system('hg init')
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 self.client = hglib.open()
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 def tearDown(self):
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 shutil.rmtree(self._testtmp)
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 def append(self, path, *args):
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21 f = open(path, 'a')
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 for a in args:
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 f.write(str(a))
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 f.close()