D7706: tests-pure: fixing test-parseindex2

gracinet (Georges Racinet) phabricator at mercurial-scm.org
Fri Dec 20 11:24:55 EST 2019


gracinet created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is a followup to D7603 <https://phab.mercurial-scm.org/D7603> (49fa0b31ee1d <https://phab.mercurial-scm.org/rHG49fa0b31ee1d84c44eab951f36fb7386e3fced22>) which broke
  the tests for pure Python implementation. There are two
  divergences between pure and C implementations:
  
  - the pure implementation would accept only -1 as slice end, whereas C accepts both -1 and len(index)
  - in pure Python, `headrevs` is provided by revlog.py, not by the index.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-parseindex2.py

CHANGE DETAILS

diff --git a/tests/test-parseindex2.py b/tests/test-parseindex2.py
--- a/tests/test-parseindex2.py
+++ b/tests/test-parseindex2.py
@@ -267,11 +267,13 @@
         appendrev(6)
         self.assertEqual(len(index), 7)
 
-        del index[1:7]
+        del index[1:-1]
 
         # assertions that failed before correction
         self.assertEqual(len(index), 1)  # was 4
-        self.assertEqual(index.headrevs(), [0])  # gave ValueError
+        headrevs = getattr(index, 'headrevs', None)
+        if headrevs is not None:  # not implemented in pure
+            self.assertEqual(index.headrevs(), [0])  # gave ValueError
 
 
 if __name__ == '__main__':



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


More information about the Mercurial-devel mailing list