Mercurial > hgsubversion
comparison tests/test_externals.py @ 337:46e69be8e2c8
Reorganize to have a more conventional module structure.
This means that hgsubversion now uses absolute imports instead of
relative ones, which makes the tests more reliable.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 13 May 2009 21:39:39 -0500 |
parents | 963d27a0b1c2 |
children | d96aa92d9ad9 |
comparison
equal
deleted
inserted
replaced
336:c0b943cef0c3 | 337:46e69be8e2c8 |
---|---|
1 import os, unittest | 1 import os, unittest |
2 | 2 |
3 from mercurial import commands | 3 from mercurial import commands |
4 | 4 |
5 import svnexternals | 5 from hgsubversion import svnexternals |
6 import test_util | 6 import test_util |
7 | 7 |
8 class TestFetchExternals(test_util.TestBase): | 8 class TestFetchExternals(test_util.TestBase): |
9 def test_externalsfile(self): | 9 def test_externalsfile(self): |
10 f = svnexternals.externalsfile() | 10 f = svnexternals.externalsfile() |
45 ('-r 148 http://svn.example.com/skinproj third-party/skins', | 45 ('-r 148 http://svn.example.com/skinproj third-party/skins', |
46 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None)), | 46 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None)), |
47 ('http://svn.example.com/skin-maker@21 third-party/skins/toolkit', | 47 ('http://svn.example.com/skin-maker@21 third-party/skins/toolkit', |
48 ('third-party/skins/toolkit', None, 'http://svn.example.com/skin-maker', '21')), | 48 ('third-party/skins/toolkit', None, 'http://svn.example.com/skin-maker', '21')), |
49 ] | 49 ] |
50 | 50 |
51 for line, expected in samples: | 51 for line, expected in samples: |
52 self.assertEqual(expected, svnexternals.parsedefinition(line)) | 52 self.assertEqual(expected, svnexternals.parsedefinition(line)) |
53 | 53 |
54 def test_externals(self, stupid=False): | 54 def test_externals(self, stupid=False): |
55 repo = self._load_fixture_and_fetch('externals.svndump', stupid=stupid) | 55 repo = self._load_fixture_and_fetch('externals.svndump', stupid=stupid) |
104 def test_updateexternals(self): | 104 def test_updateexternals(self): |
105 def checkdeps(deps, nodeps, repo, rev=None): | 105 def checkdeps(deps, nodeps, repo, rev=None): |
106 svnexternals.updateexternals(ui, [rev], repo) | 106 svnexternals.updateexternals(ui, [rev], repo) |
107 for d in deps: | 107 for d in deps: |
108 p = os.path.join(repo.root, d) | 108 p = os.path.join(repo.root, d) |
109 self.assertTrue(os.path.isdir(p), | 109 self.assertTrue(os.path.isdir(p), |
110 'missing: %s@%r' % (d, rev)) | 110 'missing: %s@%r' % (d, rev)) |
111 for d in nodeps: | 111 for d in nodeps: |
112 p = os.path.join(repo.root, d) | 112 p = os.path.join(repo.root, d) |
113 self.assertTrue(not os.path.isdir(p), | 113 self.assertTrue(not os.path.isdir(p), |
114 'unexpected: %s@%r' % (d, rev)) | 114 'unexpected: %s@%r' % (d, rev)) |
116 ui = test_util.ui.ui() | 116 ui = test_util.ui.ui() |
117 repo = self._load_fixture_and_fetch('externals.svndump', stupid=0) | 117 repo = self._load_fixture_and_fetch('externals.svndump', stupid=0) |
118 commands.update(ui, repo) | 118 commands.update(ui, repo) |
119 checkdeps(['deps/project1'], [], repo, 0) | 119 checkdeps(['deps/project1'], [], repo, 0) |
120 checkdeps(['deps/project1', 'deps/project2'], [], repo, 1) | 120 checkdeps(['deps/project1', 'deps/project2'], [], repo, 1) |
121 checkdeps(['subdir/deps/project1', 'subdir2/deps/project1', | 121 checkdeps(['subdir/deps/project1', 'subdir2/deps/project1', |
122 'deps/project2'], | 122 'deps/project2'], |
123 ['deps/project1'], repo, 2) | 123 ['deps/project1'], repo, 2) |
124 checkdeps(['subdir/deps/project1', 'deps/project2'], | 124 checkdeps(['subdir/deps/project1', 'deps/project2'], |
125 ['subdir2/deps/project1'], repo, 3) | 125 ['subdir2/deps/project1'], repo, 3) |
126 checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4) | 126 checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4) |
127 | 127 |
128 class TestPushExternals(test_util.TestBase): | 128 class TestPushExternals(test_util.TestBase): |
129 def setUp(self): | 129 def setUp(self): |