[qmtest] How do you add prerequisites test from the command line?

Mohamed Barwani mohamedb at sgi.com
Fri Aug 29 05:55:56 UTC 2008


To work around this temporarily I had to do the following.. 
Until some comes up with a better solution for parsing TupleFields contained in SetFields.

Apply this patch...
---
 qm/fields.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/qm/fields.py b/qm/fields.py
index 6434680..7d9a1ed 100644
--- a/qm/fields.py
+++ b/qm/fields.py
@@ -787,6 +787,11 @@ class TupleField(Field):
                    self.__fields, value)


+    def ParseTextValue(self, value):
+
+        return self.Validate(value)
+
+
     def ParseFormValue(self, request, name, attachment_stores):

         value = []
@@ -1240,6 +1245,12 @@ class SetField(Field):
                 invalid(tok)
             # Parse the string constant.
             v = eval(tok[1])
+            # SetFields can't contain SetFields, However they can contain a
+            # TupleField. In this case, evaluated string object would be in
+            # the following format for example
+            #   "'['test.id', 'result.outcome']'".. To work around just
+            # evaluate it again.
+            if isinstance(self.__contained,TupleField): v = eval(v)
             elements.append(self.__contained.ParseTextValue(v))

         # There should not be any tokens left over.

Then I can add prereq tests from the command line like so;
$ qmtest create --id=test_b -a resources="['res_a', 'res_b']" -a prerequisites="['[\'test_a\', \'PASS\']']" -a program=ls test command.ExecTest


cheers
-- 
Mohamed Barwani
ASGQA
"Science may set limits to knowledge, but should not set limits to imagination."
-- Bertrand Russell



More information about the qmtest mailing list