[Patch] qmtest crashes for integer attribute values

Vladimir Prus ghost at cs.msu.su
Tue Feb 5 13:57:24 UTC 2002


Hi,
There currently two problems in QMTest with handling integer attribute values:
(I'm using release-1-1-branch in CVS)
1. Storing int values in result file crashes qmtest (program return value is int)
2. Examining details for failed test crashes GUI when int annotations need to be displayed. 

The following patch fixes both problems:

Index: qm/test/result.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/result.py,v
retrieving revision 1.8.2.4
diff -u -r1.8.2.4 result.py
--- qm/test/result.py	2002/01/30 01:59:56	1.8.2.4
+++ qm/test/result.py	2002/02/05 13:47:10
@@ -278,7 +278,7 @@
             property_element = document.createElement("property")
             # The property name is an attribute.
             property_element.setAttribute("name", str(key))
-            if type(value) == types.StringType:
+            if type(value) == types.StringType or type(value) == types.IntType:
                 # The property value is contained in a text mode.
                 node = document.createTextNode(str(value))
                 property_element.appendChild(node)
Index: qm/test/classes/command.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/classes/command.py,v
retrieving revision 1.25.2.2
diff -u -r1.25.2.2 command.py
--- qm/test/classes/command.py	2002/01/17 07:25:48	1.25.2.2
+++ qm/test/classes/command.py	2002/02/05 13:47:10
@@ -391,7 +391,7 @@
                 if exit_code != self.exit_code:
                     causes.append("exit_code")
                     result["ExecTest.expected_exit_code"] = self.exit_code
-                    result["ExecTest.exit_code"] = str(exit_code)
+                    result["ExecTest.exit_code"] = exit_code
                 # Check to see if the standard output matches.
                 if stdout != self.stdout:
                     causes.append("standard output")
Index: qm/test/share/dtml/result.dtml
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/share/dtml/result.dtml,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 result.dtml
--- qm/test/share/dtml/result.dtml	2002/01/17 07:25:48	1.1.2.1
+++ qm/test/share/dtml/result.dtml	2002/02/05 13:47:10
@@ -42,7 +42,7 @@
     <dtml-if expr="annotation != result.CAUSE">
      <tr class="field">
       <td><dtml-var annotation></td>
-      <td><dtml-var expr="web.format_structured_text(result[annotation])"></td>
+      <td><dtml-var expr="web.format_structured_text(`result[annotation]`)"></td>
      </tr>
     </dtml-if>
    </dtml-let>

Actually, the use of `` makes strings looks a little bit strange ( "'string'" ), but unfortunately, 'str' can't be used 
inside expression. Maybe, dtml handling is better changed to allow 'str', I'm not sure.


- Volodya



More information about the qmtest mailing list