tests/test-rust-ancestor.py
author Boris Feld <boris.feld@octobus.net>
Wed, 19 Dec 2018 15:45:29 +0100
changeset 41036 73da729ccfef
parent 40968 74f41329bf55
child 41053 d9f439fcdb4c
permissions -rw-r--r--
test: introduce a new flag to display env variable line per line It's easier to conditionalize some of the environment variables per Mercurial version once there is only one value per line. Differential Revision: https://phab.mercurial-scm.org/D5453

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__)