Rev 199: Working test for empty patch content. in http://bzr.daniel-watkins.co.uk/pqm/abstract-patch

Daniel Watkins daniel at daniel-watkins.co.uk
Sun Jul 20 15:44:00 BST 2008


At http://bzr.daniel-watkins.co.uk/pqm/abstract-patch

------------------------------------------------------------
revno: 199
revision-id: daniel at daniel-watkins.co.uk-20080720144232-7awjf34ecez4pnnl
parent: daniel at daniel-watkins.co.uk-20080720143643-hsglti92y3i1p68z
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: abstract-patch
timestamp: Sun 2008-07-20 15:42:32 +0100
message:
  Working test for empty patch content.
-------------- next part --------------
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py	2008-07-20 14:36:43 +0000
+++ b/pqm/tests/test_pqm.py	2008-07-20 14:42:32 +0000
@@ -15,7 +15,7 @@
                        TestCaseWithQueue,
                       )
 
-from pqm.errors import PQMCmdFailure
+from pqm.errors import PQMCmdFailure, PQMException
 from pqm.PQMConfigParser import ConfigParser
 from pqm.script import (Command,
                         CommandRunner,
@@ -346,17 +346,20 @@
 
 class TestPatchCommand(TestCaseWithQueue):
 
-    def test_patch_command_applies_valid_patch(self):
+    def test_patch_command_empty_patch(self):
         tree = self.make_branch_and_tree('foo')
+        configp = ConfigParser()
+        configp.add_section('foo')
         self.getQueue(empty=True)
+        handler = pqm.BranchSpecOptionHandler(configp, queuedir='queue')
+        script = MockScript()
+
         self.build_tree(['bar/'])
         pqm.workdir = 'bar'
-        configp = ConfigParser()
-        configp.add_section('foo')
-        handler = pqm.BranchSpecOptionHandler(configp, queuedir='queue')
-        script = MockScript()
+
         command = PatchCommand(script, handler, configp, [], 'foo')
-        command.run()
+        e = self.assertRaises(PQMException, command.run)
+        self.assertEqual("'Empty patch content'", str(e))
 
 
 class FunctionalTestCommandRunner(unittest.TestCase):



More information about the bazaar-commits mailing list