comparison mercurial/testing/revlog.py @ 51265:03fdd4d7b5bd

rust-python-testing: separated base test classes This will allow, e.g., to change `test-rust-discovery.py` simply by adding the appropriate base class.
author Georges Racinet on incendie.racinet.fr <georges@racinet.fr>
date Sun, 29 Oct 2023 12:01:57 +0100
parents 7eea2e4109ae
children 96e05f1a99bd
comparison
equal deleted inserted replaced
51264:0993a3520dc6 51265:03fdd4d7b5bd
43 def parseindex(self, data=None): 43 def parseindex(self, data=None):
44 if data is None: 44 if data is None:
45 data = data_non_inlined 45 data = data_non_inlined
46 return cparsers.parse_index2(data, False)[0] 46 return cparsers.parse_index2(data, False)[0]
47 47
48
49 @unittest.skipIf(
50 MixedIndex is None,
51 'The Rust index is not available. It is needed for this test.',
52 )
53 class RustRevlogBasedTestBase(unittest.TestCase):
48 def parserustindex(self, data=None): 54 def parserustindex(self, data=None):
49 if data is None: 55 if data is None:
50 data = data_non_inlined 56 data = data_non_inlined
51 cindex = self.parseindex(data=data) 57 # not inheriting RevlogBasedTestCase to avoid having a
58 # `parseindex` method that would be shadowed by future subclasses
59 # this duplication will soon be removed
60 cindex = cparsers.parse_index2(data, False)[0]
52 return MixedIndex(cindex, data, REVLOGV1) 61 return MixedIndex(cindex, data, REVLOGV1)