Patchwork D5437: rust-cpython: testing the bindings from Python

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2018, 3:30 a.m.
Message ID <9c56ef6c651fffa77f8e2951679babd1@localhost.localdomain>
Download mbox | patch
Permalink /patch/37195/
State Not Applicable
Headers show

Comments

phabricator - Dec. 16, 2018, 3:30 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG57e3dfeb3a5d: rust-cpython: testing the bindings from Python (authored by gracinet, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5437?vs=12874&id=12886

REVISION DETAIL
  https://phab.mercurial-scm.org/D5437

AFFECTED FILES
  tests/test-rust-ancestor.py

CHANGE DETAILS




To: gracinet, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-rust-ancestor.py b/tests/test-rust-ancestor.py
new file mode 100644
--- /dev/null
+++ b/tests/test-rust-ancestor.py
@@ -0,0 +1,39 @@ 
+from __future__ import absolute_import
+import unittest
+
+try:
+    from mercurial import rustext
+except ImportError:
+    rustext = None
+
+try:
+    from mercurial.cext import parsers as cparsers
+except ImportError:
+    cparsers = None
+
+@unittest.skipIf(rustext is None or cparsers is None,
+                 "rustext.ancestor or the C Extension parsers module "
+                 "it relies on is not available")
+class rustancestorstest(unittest.TestCase):
+    """Test the correctness of binding to Rust code.
+
+    This test is merely for the binding to Rust itself: extraction of
+    Python variable, giving back the results etc.
+
+    It is not meant to test the algorithmic correctness of the operations
+    on ancestors it provides. Hence the very simple embedded index data is
+    good enough.
+
+    Algorithmic correctness is asserted by the Rust unit tests.
+    """
+
+    def testmodule(self):
+        self.assertTrue('DAG' in rustext.ancestor.__doc__)
+
+    def testgrapherror(self):
+        self.assertTrue('GraphError' in dir(rustext))
+
+
+if __name__ == '__main__':
+    import silenttestrunner
+    silenttestrunner.main(__name__)