Rev 178: Added 'empty' parameter to QueueSetup, to define whether there should be anything in the queue. in http://bzr.daniel-watkins.co.uk/pqm/empty-queue

Daniel Watkins daniel at daniel-watkins.co.uk
Thu Jul 10 17:03:29 BST 2008


At http://bzr.daniel-watkins.co.uk/pqm/empty-queue

------------------------------------------------------------
revno: 178
revision-id: daniel at daniel-watkins.co.uk-20080710160216-hazgu51bbkw9fums
parent: daniel at daniel-watkins.co.uk-20080710155822-i9toa3rw19sp0pt2
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: empty-queue
timestamp: Thu 2008-07-10 17:02:16 +0100
message:
  Added 'empty' parameter to QueueSetup, to define whether there should be anything in the queue.
-------------- next part --------------
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py	2008-07-10 15:58:22 +0000
+++ b/pqm/tests/test_pqm.py	2008-07-10 16:02:16 +0000
@@ -121,13 +121,15 @@
 class QueueSetup(object):
     """Setup a queue with mock messages in it."""
 
-    def __init__(self, processing=True):
+    def __init__(self, processing=True, empty=False):
         self.configFileName = "Foo"
         self.cwd = os.path.abspath(os.path.curdir)
-        self.message = sample_message
-        self.message_bad = sample_message_bad
-        self.message3 = sample_message_2
         self.processing = processing
+        self.empty = empty
+        if not empty:
+            self.message = sample_message
+            self.message_bad = sample_message_bad
+            self.message3 = sample_message_2
 
     def setUp(self):
         myFile=open(self.configFileName, "w")
@@ -147,18 +149,22 @@
             pass
         if not self.processing:
             open("%s/stop.patch" % (self.queuedir,), "w").close()
-        self.messageFileName = os.path.join(self.queuedir, "patch.00000001")
-        messageFile = open(self.messageFileName, "w")
-        messageFile.write(self.message)
-        messageFile.close()
-        self.messageFileNameBad = os.path.join(self.queuedir, "patch.00000002")
-        messageFile = open(self.messageFileNameBad, "w")
-        messageFile.write(self.message_bad)
-        messageFile.close()
-        self.messageFileName3 = os.path.join(self.queuedir, "patch.00000003")
-        messageFile = open(self.messageFileName3, "w")
-        messageFile.write(self.message3)
-        messageFile.close()
+        if not self.empty:
+            self.messageFileName = os.path.join(self.queuedir,
+                                                "patch.00000001")
+            messageFile = open(self.messageFileName, "w")
+            messageFile.write(self.message)
+            messageFile.close()
+            self.messageFileNameBad = os.path.join(self.queuedir,
+                                                   "patch.00000002")
+            messageFile = open(self.messageFileNameBad, "w")
+            messageFile.write(self.message_bad)
+            messageFile.close()
+            self.messageFileName3 = os.path.join(self.queuedir,
+                                                 "patch.00000003")
+            messageFile = open(self.messageFileName3, "w")
+            messageFile.write(self.message3)
+            messageFile.close()
 
     def tearDown(self):
         os.unlink(self.configFileName)



More information about the bazaar-commits mailing list