comparison tests/test_fetch_command.py @ 865:04729f3a3d17

test_util: merge load_fixture_and_fetch() into TestBase method The middle-term goal is to make TestBase repo_path and wc_path private, so they can be changed for every load call. This is not required to use nosetests multiprocess facility as the fixtures create temporary directories but it makes things much clearer and avoid weird cases where a repository was loaded several times at the same location in a single test (cf test_startrev). That way we will be more confident the tests can be parallelized. The long term goal is to make hgsubversion compatible with nosetests --processes option.
author Patrick Mezard <patrick@mezard.eu>
date Thu, 19 Apr 2012 18:29:25 +0200
parents 312b37bc5e20
children 20e73b5ab6f7
comparison
equal deleted inserted replaced
864:39d45f2190ee 865:04729f3a3d17
187 self.assertMultiLineEqual(open(fixturepaths[0]).read(), 187 self.assertMultiLineEqual(open(fixturepaths[0]).read(),
188 open(fixturepaths[1]).read()) 188 open(fixturepaths[1]).read())
189 189
190 class TestStupidPull(test_util.TestBase): 190 class TestStupidPull(test_util.TestBase):
191 def test_stupid(self): 191 def test_stupid(self):
192 repo = test_util.load_fixture_and_fetch('two_heads.svndump', 192 repo = self._load_fixture_and_fetch('two_heads.svndump', stupid=True)
193 self.repo_path,
194 self.wc_path,
195 True)
196 self.assertEqual(node.hex(repo[0].node()), 193 self.assertEqual(node.hex(repo[0].node()),
197 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') 194 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
198 self.assertEqual(node.hex(repo['tip'].node()), 195 self.assertEqual(node.hex(repo['tip'].node()),
199 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') 196 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
200 self.assertEqual(node.hex(repo['the_branch'].node()), 197 self.assertEqual(node.hex(repo['the_branch'].node()),
208 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6') 205 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6')
209 self.assertEqual(repo['tip'], repo['default']) 206 self.assertEqual(repo['tip'], repo['default'])
210 self.assertEqual(len(repo.heads()), 2) 207 self.assertEqual(len(repo.heads()), 2)
211 208
212 def test_oldest_not_trunk_and_tag_vendor_branch(self): 209 def test_oldest_not_trunk_and_tag_vendor_branch(self):
213 repo = test_util.load_fixture_and_fetch( 210 repo = self._load_fixture_and_fetch(
214 'tagged_vendor_and_oldest_not_trunk.svndump', 211 'tagged_vendor_and_oldest_not_trunk.svndump',
215 self.repo_path, 212 stupid=True)
216 self.wc_path,
217 True)
218 repo = hg.repository(ui.ui(), self.wc_path)
219 self.assertEqual(node.hex(repo['oldest'].node()), 213 self.assertEqual(node.hex(repo['oldest'].node()),
220 '926671740dec045077ab20f110c1595f935334fa') 214 '926671740dec045077ab20f110c1595f935334fa')
221 self.assertEqual(repo['tip'].parents()[0].parents()[0], 215 self.assertEqual(repo['tip'].parents()[0].parents()[0],
222 repo['oldest']) 216 repo['oldest'])
223 self.assertEqual(node.hex(repo['tip'].node()), 217 self.assertEqual(node.hex(repo['tip'].node()),