Mercurial > hgsubversion
comparison tests/test_util.py @ 82:71de43e9f614
Extract PushTest common code into test_util.TestBase
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 14 Nov 2008 16:18:24 -0600 |
parents | 072010a271c6 |
children | 6c9b7cf1c5aa |
comparison
equal
deleted
inserted
replaced
81:85dcea81f22b | 82:71de43e9f614 |
---|---|
1 import errno | 1 import errno |
2 import os | 2 import os |
3 import subprocess | 3 import subprocess |
4 import shutil | 4 import shutil |
5 import stat | 5 import stat |
6 import tempfile | |
7 import unittest | |
6 import urllib | 8 import urllib |
7 | 9 |
8 from mercurial import ui | 10 from mercurial import ui |
9 from mercurial import hg | 11 from mercurial import hg |
10 | 12 |
11 import fetch_command | 13 import fetch_command |
14 import push_cmd | |
12 | 15 |
13 FIXTURES = os.path.join(os.path.abspath(os.path.dirname(__file__)), | 16 FIXTURES = os.path.join(os.path.abspath(os.path.dirname(__file__)), |
14 'fixtures') | 17 'fixtures') |
15 | 18 |
16 def fileurl(path): | 19 def fileurl(path): |
55 continue | 58 continue |
56 raise | 59 raise |
57 if (s.st_mode & stat.S_IWRITE) == 0: | 60 if (s.st_mode & stat.S_IWRITE) == 0: |
58 os.chmod(f, s.st_mode | stat.S_IWRITE) | 61 os.chmod(f, s.st_mode | stat.S_IWRITE) |
59 shutil.rmtree(path) | 62 shutil.rmtree(path) |
63 | |
64 class TestBase(unittest.TestCase): | |
65 def setUp(self): | |
66 self.oldwd = os.getcwd() | |
67 self.tmpdir = tempfile.mkdtemp('svnwrap_test') | |
68 self.repo_path = '%s/testrepo' % self.tmpdir | |
69 self.wc_path = '%s/testrepo_wc' % self.tmpdir | |
70 | |
71 def tearDown(self): | |
72 rmtree(self.tmpdir) | |
73 os.chdir(self.oldwd) | |
74 | |
75 # define this as a property so that it reloads anytime we need it | |
76 @property | |
77 def repo(self): | |
78 return hg.repository(ui.ui(), self.wc_path) | |
79 | |
80 def pushrevisions(self): | |
81 push_cmd.push_revisions_to_subversion( | |
82 ui.ui(), repo=self.repo, hg_repo_path=self.wc_path, | |
83 svn_url=fileurl(self.repo_path)) |