Patchwork D7707: tests-pure: fixing test-parseindex2

login
register
mail settings
Submitter phabricator
Date Dec. 20, 2019, 4:26 p.m.
Message ID <differential-rev-PHID-DREV-l5ogebjzksi3xrunattq-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44012/
State Superseded
Headers show

Comments

phabricator - Dec. 20, 2019, 4:26 p.m.
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/D7707

AFFECTED FILES
  tests/test-parseindex2.py

CHANGE DETAILS




To: gracinet, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 20, 2019, 5:48 p.m.
martinvonz added a comment.


  This seems to be a duplicate of D7706 <https://phab.mercurial-scm.org/D7706>. Could you abandon one of them?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7707/new/

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

To: gracinet, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - Dec. 20, 2019, 6:59 p.m.
gracinet added a comment.


  I'm keeping this one.
  
  First phabsend got interrupted, this one has the proper reference in its description.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7707/new/

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

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

Patch

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__':