Mercurial > hgsubversion
comparison tests/test_fetch_exec.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 | d741f536f23a |
comparison
equal
deleted
inserted
replaced
864:39d45f2190ee | 865:04729f3a3d17 |
---|---|
3 import unittest | 3 import unittest |
4 | 4 |
5 from mercurial import node | 5 from mercurial import node |
6 | 6 |
7 class TestFetchExec(test_util.TestBase): | 7 class TestFetchExec(test_util.TestBase): |
8 def _load_fixture_and_fetch(self, fixture_name, stupid): | |
9 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, | |
10 self.wc_path, stupid=stupid) | |
11 | |
12 def assertexec(self, ctx, files, isexec=True): | 8 def assertexec(self, ctx, files, isexec=True): |
13 for f in files: | 9 for f in files: |
14 self.assertEqual(isexec, 'x' in ctx[f].flags()) | 10 self.assertEqual(isexec, 'x' in ctx[f].flags()) |
15 | 11 |
16 def test_exec(self, stupid=False): | 12 def test_exec(self, stupid=False): |
17 repo = self._load_fixture_and_fetch('executebit.svndump', stupid) | 13 repo = self._load_fixture_and_fetch('executebit.svndump', stupid=stupid) |
18 self.assertexec(repo[0], ['text1', 'binary1', 'empty1'], True) | 14 self.assertexec(repo[0], ['text1', 'binary1', 'empty1'], True) |
19 self.assertexec(repo[0], ['text2', 'binary2', 'empty2'], False) | 15 self.assertexec(repo[0], ['text2', 'binary2', 'empty2'], False) |
20 self.assertexec(repo[1], ['text1', 'binary1', 'empty1'], False) | 16 self.assertexec(repo[1], ['text1', 'binary1', 'empty1'], False) |
21 self.assertexec(repo[1], ['text2', 'binary2', 'empty2'], True) | 17 self.assertexec(repo[1], ['text2', 'binary2', 'empty2'], True) |
22 | 18 |
23 def test_exec_stupid(self): | 19 def test_exec_stupid(self): |
24 self.test_exec(True) | 20 self.test_exec(True) |
25 | 21 |
26 def test_empty_prop_val_executable(self, stupid=False): | 22 def test_empty_prop_val_executable(self, stupid=False): |
27 repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump', stupid) | 23 repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump', |
24 stupid=stupid) | |
28 self.assertEqual(node.hex(repo['tip'].node()), | 25 self.assertEqual(node.hex(repo['tip'].node()), |
29 '08e6b380bf291b361a418203a1cb9427213cd1fd') | 26 '08e6b380bf291b361a418203a1cb9427213cd1fd') |
30 self.assertEqual(repo['tip']['foo'].flags(), 'x') | 27 self.assertEqual(repo['tip']['foo'].flags(), 'x') |
31 | 28 |
32 def test_empty_prop_val_executable_stupid(self): | 29 def test_empty_prop_val_executable_stupid(self): |