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.
--- 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)
--- a/tests/test-rust-ancestor.py Sun Oct 29 11:21:18 2023 +0100
+++ b/tests/test-rust-ancestor.py Sun Oct 29 12:01:57 2023 +0100
@@ -36,7 +36,7 @@
'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