Rev 4663: Start rewriting the TestResolveUnversionedParent into white box tests. in file:///home/vila/src/bzr/experimental/conflict-manager/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Nov 15 17:04:25 GMT 2010
At file:///home/vila/src/bzr/experimental/conflict-manager/
------------------------------------------------------------
revno: 4663
revision-id: v.ladeuil+lp at free.fr-20101115170425-735jiy0zchs30gx9
parent: v.ladeuil+lp at free.fr-20101115092403-rjd4a6854nzaalpt
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: more-tests
timestamp: Mon 2010-11-15 18:04:25 +0100
message:
Start rewriting the TestResolveUnversionedParent into white box tests.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py 2010-11-15 09:24:03 +0000
+++ b/bzrlib/tests/test_conflicts.py 2010-11-15 17:04:25 +0000
@@ -631,7 +631,59 @@
_assert_conflict = assertDuplicateEntry
-class TestResolveUnversionedParent(TestResolveConflicts):
+class TestResolveUnversionedParent(TestParametrizedResolveConflicts):
+
+ # FIXME: While this *creates* UnversionedParent conflicts, this really only
+ # tests MissingParent resolution :-/
+ scenarios = mirror_scenarios(
+ [
+ # File modified/deleted
+ (dict(_base_actions='create_dir',
+ _path='dir_or_file', _file_id='dir-id'),
+ ('dir_deleted',
+ dict(actions='delete_dir', check='dir_doesnt_exist')),
+ ('file_added',
+ dict(actions='add_file', check='file_has_content')),),
+ ])
+
+ def do_create_dir(self):
+ return [('add', ('dir', 'dir-id', 'directory', ''))]
+
+ def do_delete_dir(self):
+ return [('unversion', 'dir-id')]
+
+ def check_dir_doesnt_exist(self):
+ self.failIfExists('branch/dir')
+
+ def do_add_file(self):
+ return [('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
+
+ def check_file_has_content(self):
+ self.assertFileEqual('trunk content\n', 'branch/dir/file')
+
+ def _get_resolve_path_arg(self, wt, action):
+ return 'dir'
+
+ def assertConflict(self, wt):
+ confs = wt.conflicts()
+ # We've got 2 conflicts here. This is bad for us as it means more code
+ # (and more complexity). This is bad for the user as it makes the
+ # conflict harder to understand and deal with.
+ self.assertLength(2, confs)
+ c = confs[0]
+ self.assertIsInstance(c, (conflicts.MissingParent,
+ conflicts.DeletingParent))
+ self.assertEqual('dir-id', c.file_id)
+ self.assertEqual('dir', c.path)
+ # May be we should merge the UnversionParent one into the associated
+ # Missing/DeletingParent when they apply to the same dir ?
+ c = confs[1]
+ self.assertIsInstance(c, conflicts.UnversionedParent)
+ self.assertEqual('dir-id', c.file_id)
+ self.assertEqual('dir', c.path)
+
+
+class OldTestResolveUnversionedParent(TestResolveConflicts):
# FIXME: Add the reverse tests: dir deleted in trunk, file added in branch
@@ -657,6 +709,9 @@
2>Conflict adding files to dir. Created directory.
2>Conflict because dir is not versioned, but has versioned children. Versioned directory.
2>2 conflicts encountered.
+$ bzr conflicts
+Conflict adding files to dir. Created directory.
+Conflict because dir is not versioned, but has versioned children. Versioned directory.
"""
def test_take_this(self):
More information about the bazaar-commits
mailing list