changeset 1321:a36e87ae2380

tests: always compare manifest keys in sorted order Not comparing sorted lists was probably always a mistake, but it became an actual failure when upstream Mercurial changed to using lazymanifest, which always returns keys in sorted order.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 27 Mar 2015 16:44:05 -0700
parents 2061fd988f3f
children fd3461f86582
files tests/test_fetch_branches.py tests/test_push_command.py tests/test_push_renames.py tests/test_single_dir_clone.py tests/test_tags.py
diffstat 5 files changed, 21 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -82,8 +82,8 @@ class TestFetchBranches(test_util.TestBa
 
     def test_branch_create_with_dir_delete_works(self):
         repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump')
-        self.assertEqual(repo['tip'].manifest().keys(),
-                         ['alpha', 'beta', 'iota', 'gamma', ])
+        self.assertEqual(sorted(repo['tip'].manifest().keys()),
+                         ['alpha', 'beta', 'gamma', 'iota', ])
 
     def test_branch_tip_update_to_default(self):
         repo = self._load_fixture_and_fetch('unorderedbranch.svndump',
--- a/tests/test_push_command.py
+++ b/tests/test_push_command.py
@@ -267,8 +267,8 @@ class PushTests(test_util.TestBase):
         commands.push(repo.ui, repo)
         self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash)
         self.assertEqual(self.repo['tip'].files(), ['delta', ])
-        self.assertEqual(self.repo['tip'].manifest().keys(),
-                         ['alpha', 'beta', 'gamma', 'delta'])
+        self.assertEqual(sorted(self.repo['tip'].manifest().keys()),
+                         ['alpha', 'beta', 'delta', 'gamma'])
 
     def test_push_two_revs(self):
         # set up some work for us
@@ -419,8 +419,9 @@ class PushTests(test_util.TestBase):
         self.assert_('@' in self.repo['tip'].user())
         self.assertEqual(tip['gamma'].flags(), 'x')
         self.assertEqual(tip['gamma'].data(), 'foo')
-        self.assertEqual([x for x in tip.manifest().keys() if 'x' not in
-                          tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
+        self.assertEqual(sorted([x for x in tip.manifest().keys() if 'x' not in
+                                tip[x].flags()]),
+                         ['adding_file', 'alpha', 'beta', ])
 
     def test_push_symlink_file(self):
         self.test_push_to_default(commit=True)
@@ -451,8 +452,9 @@ class PushTests(test_util.TestBase):
         self.assertNotEqual(tip.node(), new_hash)
         self.assertEqual(tip['gamma'].flags(), 'l')
         self.assertEqual(tip['gamma'].data(), 'foo')
-        self.assertEqual([x for x in tip.manifest().keys() if 'l' not in
-                          tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
+        self.assertEqual(sorted([x for x in tip.manifest().keys() if 'l' not in
+                                 tip[x].flags()]),
+                         ['adding_file', 'alpha', 'beta', ])
 
         def file_callback2(repo, memctx, path):
             if path == 'gamma':
@@ -636,7 +638,7 @@ class PushTests(test_util.TestBase):
         parent = self.repo['tip'].rev()
         self.commitchanges(changes, parent=parent)
         self.pushrevisions()
-        self.assertEqual({}, self.repo['tip'].manifest())
+        self.assertEqual(len(self.repo['tip'].manifest()), 0)
 
         # Try to re-add a file after emptying the branch
         changes = [
--- a/tests/test_push_renames.py
+++ b/tests/test_push_renames.py
@@ -66,8 +66,8 @@ class TestPushRenames(test_util.TestBase
             ]
         self.commitchanges(changes)
         self.pushrevisions()
-        self.assertEqual(self.repo['tip'].manifest().keys(),
-                         ['a', 'c', 'b', 'e', 'd',
+        self.assertEqual(sorted(self.repo['tip'].manifest().keys()),
+                         ['a', 'b', 'c', 'd', 'e',
                           'random2/dir with space/file with space'])
 
     def test_push_rename_tree(self):
--- a/tests/test_single_dir_clone.py
+++ b/tests/test_single_dir_clone.py
@@ -21,15 +21,15 @@ class TestSingleDirClone(test_util.TestB
                                             subdir='')
         self.assertEqual(compathacks.branchset(repo),
                          set(['default']))
-        self.assertEqual(repo['tip'].manifest().keys(),
-                         ['trunk/beta',
+        self.assertEqual(sorted(repo['tip'].manifest().keys()),
+                         ['branches/branch_from_tag/alpha',
+                          'branches/branch_from_tag/beta',
                           'tags/copied_tag/alpha',
-                          'trunk/alpha',
                           'tags/copied_tag/beta',
-                          'branches/branch_from_tag/alpha',
                           'tags/tag_r3/alpha',
                           'tags/tag_r3/beta',
-                          'branches/branch_from_tag/beta'])
+                          'trunk/alpha',
+                          'trunk/beta'])
 
     def test_auto_detect_single(self):
         repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -138,16 +138,9 @@ rename a tag
             'branch': 'magic',
             'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@14'})
        self.assertEqual(repo[alsoedit].parents()[0].node(), repo.tags()['also-edit'])
-       self.assertEqual(repo['also-edit'].manifest().keys(),
-                        ['beta',
-                         '.hgtags',
-                         'delta',
-                         'alpha',
-                         'omega',
-                         'iota',
-                         'gamma',
-                         'lambda',
-                         ])
+       self.assertEqual(sorted(repo['also-edit'].manifest().keys()),
+                        ['.hgtags', 'alpha', 'beta', 'delta', 'gamma', 'iota',
+                         'lambda', 'omega'])
 
        self.assertEqual(editlater, repo['edit-later'].node())
        self.assertEqual(