Rev 169: Fixed failing tests. in http://bzr.daniel-watkins.co.uk/pqm/merge-directives
Daniel Watkins
daniel at daniel-watkins.co.uk
Wed Jul 9 04:37:24 BST 2008
At http://bzr.daniel-watkins.co.uk/pqm/merge-directives
------------------------------------------------------------
revno: 169
revision-id: daniel at daniel-watkins.co.uk-20080709033613-tfssv1v7f8m3aesw
parent: daniel at daniel-watkins.co.uk-20080708141512-tduwmzmxsuo90ncb
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: merge-directives
timestamp: Wed 2008-07-09 04:36:13 +0100
message:
Fixed failing tests.
-------------- next part --------------
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py 2008-07-08 13:32:14 +0000
+++ b/pqm/tests/test_pqm.py 2008-07-09 03:36:13 +0000
@@ -190,11 +190,6 @@
self.queue = QueueSetup()
self.queue.setUp()
- def testName(self):
- patch = pqm.Script('foo.script', logging, False, 0, None, None)
- self.assertEqual(patch.filename, 'foo.script')
- self.scriptname = 'fpp'
-
def tearDown(self):
try:
os.unlink(self.scriptname)
@@ -214,6 +209,14 @@
handler = pqm.BranchSpecOptionHandler(configp)
return pqm.Script(self.scriptname, logging, False, 54, handler, configp)
+
+class TestQueueDirectory(TestWithQueueDirectory):
+
+ def testName(self):
+ patch = pqm.Script('foo.script', logging, False, 0, None, None)
+ self.assertEqual(patch.filename, 'foo.script')
+ self.scriptname = 'fpp'
+
def testFields(self):
script = self.getScript(sample_message)
self.assertEqual(script.getSender(), "John.Citizen at example.com")
@@ -306,29 +309,6 @@
content = file(self.queue.queuedir + '/pqm/status').read()
self.assertEqual('bar\nfoo\n', content)
- def test_blackbox(self):
- from bzrlib.branch import Branch
- from bzrlib.merge_directive import MergeDirective
- branch = Branch.open("bzrbranch")
- self.assertEqual(
- branch.repository.get_revision(branch.last_revision()).message,
- 'start branch.')
- contrib_branch = Branch.open("branch-contributor")
- self.assertEqual(contrib_branch.repository.get_revision(
- contrib_branch.last_revision()).message,
- 'add README')
- directive = MergeDirective.from_objects(contrib_branch.repository,
- contrib_branch.last_revision(), 0, 0, branch)
- script = getScript(''.join(directive.to_lines()))
- self.failIf(os.path.exists("bzrbranch/README"))
- self.failIf(os.path.exists("bzrbranch/NEWS"))
- bundle = StringIO()
- write_bundle(contrib_branch.repository, 'revision-2', 'revision-0',
- bundle)
- handler = pqm.Bazaar2Handler()
- result = handler.do_bzr_merge("me", 'revision-1', t.as_sha1(),
- "bzrbranch", bundle=bundle.getvalue())
-
# NOTDONEYET: move command recognition from CommandRunner to Script
# and commands should follow the command pattern rather than being strings.
@@ -559,6 +539,9 @@
shutil.rmtree("bzrbranch-parent")
shutil.rmtree("bzrbranch-public")
+
+class TestBzrHandler(BzrHandlerTestCase):
+
def test_commit(self):
from bzrlib.branch import Branch
branch = Branch.open("bzrbranch")
@@ -718,6 +701,47 @@
self.fail("Merge conflict not raised.")
+class TestBlackbox(BzrHandlerTestCase, TestWithQueueDirectory):
+
+ def setUp(self):
+ BzrHandlerTestCase.setUp(self)
+ TestWithQueueDirectory.setUp(self)
+
+ def test_blackbox(self):
+ from bzrlib.branch import Branch
+ from bzrlib.bundle.serializer import write_bundle
+ from bzrlib.merge_directive import MergeDirective
+ from bzrlib.testament import StrictTestament3
+ branch = Branch.open("bzrbranch")
+ self.assertEqual(
+ branch.repository.get_revision(branch.last_revision()).message,
+ 'start branch.')
+ contrib_branch = Branch.open("branch-contributor")
+ self.assertEqual(contrib_branch.repository.get_revision(
+ contrib_branch.last_revision()).message,
+ 'add README')
+ repo = contrib_branch.repository
+ repo.lock_write()
+ try:
+ directive = MergeDirective.from_objects(repo,
+ contrib_branch.last_revision(), 0, 0,
+ branch.bzrdir.root_transport.base)
+ script = self.getScript(''.join(directive.to_lines()))
+ self.failIf(os.path.exists("bzrbranch/README"))
+ self.failIf(os.path.exists("bzrbranch/NEWS"))
+ t = StrictTestament3.from_revision(contrib_branch.repository,
+ 'revision-1')
+ bundle = StringIO()
+ write_bundle(contrib_branch.repository, 'revision-2',
+ 'revision-0', bundle)
+ handler = pqm.Bazaar2Handler()
+ result = handler.do_bzr_merge("me", 'revision-1', t.as_sha1(),
+ "bzrbranch",
+ bundle=bundle.getvalue())
+ finally:
+ repo.unlock()
+
+
class TestConfig(unittest.TestCase):
def test_location_overrides(self):
More information about the bazaar-commits
mailing list