Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch: Fix deletion of 'qmtest.id' context variable if resource setup fails.


  • To: qmtest@xxxxxxxxxxxxxxxx
  • Subject: patch: Fix deletion of 'qmtest.id' context variable if resource setup fails.
  • From: Stefan Seefeld <stefan@xxxxxxxxxxxxxxxx>
  • Date: Wed, 29 Nov 2006 21:24:58 -0500

The attached patch moves the deletion of the 'qmtest.id' context variable
to a place where it is safe to delete it. This fix is checked in.

Thanks,
		Stefan

-- 
Stefan Seefeld
CodeSourcery
stefan@xxxxxxxxxxxxxxxx
(650) 331-3385 x718
Index: ChangeLog
===================================================================
RCS file: /home/qm/Repository/qm/ChangeLog,v
retrieving revision 1.724
diff -u -r1.724 ChangeLog
--- ChangeLog	23 Nov 2006 16:43:44 -0000	1.724
+++ ChangeLog	30 Nov 2006 02:19:20 -0000
@@ -1,3 +1,8 @@
+2006-11-29  Stefan Seefeld  <stefan@xxxxxxxxxxxxxxxx>
+
+	* qm/test/target.py: Only delete the 'qmtest.id' context variable if it
+	really exists.
+
 2006-11-23  Stefan Seefeld  <stefan@xxxxxxxxxxxxxxxx>
 
 	* qmdist/command/install_lib.py: Force recompilation of generated 
Index: qm/test/target.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/target.py,v
retrieving revision 1.29
diff -u -r1.29 target.py
--- qm/test/target.py	2 Nov 2006 15:15:43 -0000	1.29
+++ qm/test/target.py	30 Nov 2006 02:19:21 -0000
@@ -323,9 +323,6 @@
         # guarantee that it will be the same in a test that depends on
         # this resource as it was in the resource itself.
         del properties[Context.TMPDIR_CONTEXT_PROPERTY]
-        # Similarly, the ID property should be the name of the dependent
-        # entity, not the name of the reosurce.
-        del properties[Context.ID_CONTEXT_PROPERTY]
         rop = (resource, result.GetOutcome(), properties)
         self.__resources[result.GetId()] = rop
         self.__order_of_resources.append(result.GetId())
@@ -388,7 +385,10 @@
             # Make the ID of the resource available.
             wrapper[Context.ID_CONTEXT_PROPERTY] = resource_name
             # Set up the resource itself.
-            resource_desc.SetUp(wrapper, result)
+            try:
+                resource_desc.SetUp(wrapper, result)
+            finally:
+                del wrapper[Context.ID_CONTEXT_PROPERTY]
             # Obtain the resource within the try-block so that if it
             # cannot be obtained the exception is handled below.
             resource = resource_desc.GetItem()