[qmtest] Resource creation
Mark Mitchell
mark at codesourcery.com
Fri Aug 29 23:03:55 UTC 2003
On Thu, 2003-08-28 at 13:42, Lewis, Pat H. wrote:
> I am having problems with creating resources when using the GUI. If I have
> a test that relies on a resource, when I run the test the first time,
> everything works as expected. The resource is created and destroyed
> properly. However, on the second (and subsequent) 'Run', it appears that
> the SetUp method of the resource is not called. However, the CleanUp method
> is called on each subsequent run.
>
> I have a really simple resource to demonstrate the problem.
Good find!
I've checked in this patch to fix the problem.
--
Mark Mitchell <mark at codesourcery.com>
CodeSourcery, LLC
-------------- next part --------------
2003-08-29 Mark Mitchell <mark at codesourcery.com>
* qm/test/target.py (Target.__init__): Do not set __resources.
(Target.Start): Initialize __resources.
(Target.Stop): Remove entries created by Target.Start.
Index: target.py
===================================================================
RCS file: /home/sc/Repository/qm/qm/test/target.py,v
retrieving revision 1.21
diff -c -5 -p -r1.21 target.py
*** target.py 11 Aug 2003 22:55:14 -0000 1.21
--- target.py 29 Aug 2003 22:55:18 -0000
*************** class Target(qm.extension.Extension):
*** 98,110 ****
qm.extension.Extension.__init__(self, properties)
self.__database = database
- # There are no resources available on this target.
- self.__resources = {}
-
def GetName(self):
"""Return the name of the target.
Derived classes must not override this method."""
--- 98,107 ----
*************** class Target(qm.extension.Extension):
*** 168,177 ****
--- 165,176 ----
method must call this method at some point during its
execution."""
self.__response_queue = response_queue
self.__engine = engine
+ # There are no resources available on this target yet.
+ self.__resources = {}
def Stop(self):
"""Stop the target.
*************** class Target(qm.extension.Extension):
*** 183,192 ****
--- 182,194 ----
# Clean up any available resources.
for (name, rop) in self.__resources.items():
if rop and rop[1] == Result.PASS:
self._CleanUpResource(name, rop[0])
+ del self.__response_queue
+ del self.__engine
+ del self.__resources
def RunTest(self, descriptor, context):
"""Run the test given by 'test_id'.
More information about the qmtest
mailing list