comparison tests/test_fetch_exec.py @ 1063:449c61eeace7

test_fetch_exec: use metaclass stupid mode tests
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 09 Aug 2013 23:45:55 +0200
parents d741f536f23a
children
comparison
equal deleted inserted replaced
1062:36a5fa6420a0 1063:449c61eeace7
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 stupid_mode_tests = True
9
8 def assertexec(self, ctx, files, isexec=True): 10 def assertexec(self, ctx, files, isexec=True):
9 for f in files: 11 for f in files:
10 self.assertEqual(isexec, 'x' in ctx[f].flags()) 12 self.assertEqual(isexec, 'x' in ctx[f].flags())
11 13
12 def test_exec(self, stupid=False): 14 def test_exec(self):
13 repo = self._load_fixture_and_fetch('executebit.svndump', stupid=stupid) 15 repo = self._load_fixture_and_fetch('executebit.svndump')
14 self.assertexec(repo[0], ['text1', 'binary1', 'empty1'], True) 16 self.assertexec(repo[0], ['text1', 'binary1', 'empty1'], True)
15 self.assertexec(repo[0], ['text2', 'binary2', 'empty2'], False) 17 self.assertexec(repo[0], ['text2', 'binary2', 'empty2'], False)
16 self.assertexec(repo[1], ['text1', 'binary1', 'empty1'], False) 18 self.assertexec(repo[1], ['text1', 'binary1', 'empty1'], False)
17 self.assertexec(repo[1], ['text2', 'binary2', 'empty2'], True) 19 self.assertexec(repo[1], ['text2', 'binary2', 'empty2'], True)
18 20
19 def test_exec_stupid(self): 21 def test_empty_prop_val_executable(self):
20 self.test_exec(True) 22 repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump')
21
22 def test_empty_prop_val_executable(self, stupid=False):
23 repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump',
24 stupid=stupid)
25 self.assertEqual(node.hex(repo['tip'].node()), 23 self.assertEqual(node.hex(repo['tip'].node()),
26 '08e6b380bf291b361a418203a1cb9427213cd1fd') 24 '08e6b380bf291b361a418203a1cb9427213cd1fd')
27 self.assertEqual(repo['tip']['foo'].flags(), 'x') 25 self.assertEqual(repo['tip']['foo'].flags(), 'x')
28
29 def test_empty_prop_val_executable_stupid(self):
30 self.test_empty_prop_val_executable(True)