diff tests/test_push_command.py @ 1048:903c9c9dfe6a

tests: count revisions explicitly The assumption that len(repo) corresponds to the count of actual, usable revision in the repository fails in presence of hidden revisions. Instead, we use a dedicated method in test_util, and change all tests to use this for obtaining repository length -- just to be safe...
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 09 Aug 2013 11:22:50 -0400
parents d741f536f23a
children 2d7398fffd0d
line wrap: on
line diff
--- a/tests/test_push_command.py
+++ b/tests/test_push_command.py
@@ -578,7 +578,7 @@ class PushTests(test_util.TestBase):
         on top of the pushed commit.
         '''
 
-        oldlen = len(self.repo)
+        oldlen = test_util.repolen(self.repo)
         oldtiphash = self.repo['default'].node()
 
         changes = [('gamma', 'gamma', 'sometext')]
@@ -591,7 +591,7 @@ class PushTests(test_util.TestBase):
         repo = self.repo
         hg.update(repo, newhash1)
         commands.push(repo.ui, repo)
-        self.assertEqual(len(self.repo), oldlen + 2)
+        self.assertEqual(test_util.repolen(self.repo), oldlen + 2)
 
         # verify that the first commit is pushed, and the second is not
         commit2 = self.repo['tip']
@@ -609,7 +609,7 @@ class PushTests(test_util.TestBase):
         This test verifies that code path works.
         '''
 
-        oldlen = len(self.repo)
+        oldlen = test_util.repolen(self.repo)
         oldtiphash = self.repo['default'].node()
 
         changes = [('gamma', 'gamma', 'sometext')]
@@ -622,7 +622,7 @@ class PushTests(test_util.TestBase):
         repo = self.repo
         hg.update(repo, newhash)
         commands.push(repo.ui, repo)
-        self.assertEqual(len(self.repo), oldlen + 2)
+        self.assertEqual(test_util.repolen(self.repo), oldlen + 2)
 
         # verify that both commits are pushed
         commit1 = self.repo['tip']