diff --git a/mercurial/testing/revlog.py b/mercurial/testing/revlog.py --- a/mercurial/testing/revlog.py +++ b/mercurial/testing/revlog.py @@ -45,8 +45,17 @@ class RevlogBasedTestBase(unittest.TestC data = data_non_inlined return cparsers.parse_index2(data, False)[0] + +@unittest.skipIf( + MixedIndex is None, + 'The Rust index is not available. It is needed for this test.', +) +class RustRevlogBasedTestBase(unittest.TestCase): def parserustindex(self, data=None): if data is None: data = data_non_inlined - cindex = self.parseindex(data=data) + # not inheriting RevlogBasedTestCase to avoid having a + # `parseindex` method that would be shadowed by future subclasses + # this duplication will soon be removed + cindex = cparsers.parse_index2(data, False)[0] return MixedIndex(cindex, data, REVLOGV1) diff --git a/tests/test-rust-ancestor.py b/tests/test-rust-ancestor.py --- a/tests/test-rust-ancestor.py +++ b/tests/test-rust-ancestor.py @@ -36,7 +36,7 @@ except ImportError: 'The Rust or C version of the "parsers" module, which the "ancestor" module' ' relies on, is not available.', ) -class rustancestorstest(revlogtesting.RevlogBasedTestBase): +class rustancestorstest(revlogtesting.RustRevlogBasedTestBase): """Test the correctness of binding to Rust code. This test is merely for the binding to Rust itself: extraction of