diff 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
line wrap: on
line diff
--- a/mercurial/testing/revlog.py	Sun Oct 29 11:21:18 2023 +0100
+++ b/mercurial/testing/revlog.py	Sun Oct 29 12:01:57 2023 +0100
@@ -45,8 +45,17 @@
             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)