tests/test-rust-ancestor.py
branchstable
changeset 41350 ab0d762d89ef
parent 41246 619ee4039bd4
child 41694 0c7b353ce100
equal deleted inserted replaced
41349:ee943a920606 41350:ab0d762d89ef
     1 from __future__ import absolute_import
     1 from __future__ import absolute_import
     2 import sys
     2 import sys
     3 import unittest
     3 import unittest
       
     4 
       
     5 from mercurial import (
       
     6     error,
       
     7     node,
       
     8 )
     4 
     9 
     5 try:
    10 try:
     6     from mercurial import rustext
    11     from mercurial import rustext
     7     rustext.__name__  # trigger immediate actual import
    12     rustext.__name__  # trigger immediate actual import
     8 except ImportError:
    13 except ImportError:
   151         exc = arc.exception
   156         exc = arc.exception
   152         self.assertIsInstance(exc, ValueError)
   157         self.assertIsInstance(exc, ValueError)
   153         # rust-cpython issues appropriate str instances for Python 2 and 3
   158         # rust-cpython issues appropriate str instances for Python 2 and 3
   154         self.assertEqual(exc.args, ('ParentOutOfRange', 1))
   159         self.assertEqual(exc.args, ('ParentOutOfRange', 1))
   155 
   160 
       
   161     def testwdirunsupported(self):
       
   162         # trying to access ancestors of the working directory raises
       
   163         # WdirUnsupported directly
       
   164         idx = self.parseindex()
       
   165         with self.assertRaises(error.WdirUnsupported):
       
   166             list(AncestorsIterator(idx, [node.wdirrev], -1, False))
   156 
   167 
   157 if __name__ == '__main__':
   168 if __name__ == '__main__':
   158     import silenttestrunner
   169     import silenttestrunner
   159     silenttestrunner.main(__name__)
   170     silenttestrunner.main(__name__)