[ Date Prev][ Date Next][ Thread Prev][ Thread Next][ Date Index][ Thread Index]
qmtest exceptiontest
- To: qmtest@xxxxxxxxxxxxxxxx
- Subject: qmtest exceptiontest
- From: "Rodrigo Belem" <rclbelem@xxxxxxxxx>
- Date: Tue, 17 Apr 2007 18:11:05 -0400
Hi Stefan,
Trying to use QMTest on python2.5 I faced a problem which I've solved
with a small change on the source code. The problem is that on the
file qmtest/qm/test/classes/python.py there is a expression evaluation
"type(exc_info[0]) is types.ClassType" which will always fail on
python2.5. If you check by yourself, you'll see that
"type(exc_info[0])" will return different results on python2.5 and
python2.4, for example.
Please see the attached patch and let me know your opinion about.
Regards,
Rodrigo Belem.
--- qmtest.orig/qm/test/classes/python.py 2007-04-17 16:55:40.000000000 -0400
+++ qmtest/qm/test/classes/python.py 2007-04-17 18:00:25.000000000 -0400
@@ -223,10 +223,13 @@
def MakeResult(self, exc_info, result):
- # Make sure the exception is an object.
- if not type(exc_info[0]) is types.ClassType:
- result.Fail(qm.message("test raised non-object",
- exc_type=str(type(exc_info[0]))))
+ # On Python 2.5 type(exc_info[0]) is not a classobj
+ if sys.version_info[:2] <= (2, 4)
+ # Make sure the exception is an object.
+ if not type(exc_info[0]) is types.ClassType:
+ result.Fail(qm.message("test raised non-object",
+ exc_type=str(type(exc_info[0]))))
+
# Make sure it's an instance of the right class.
exception_class_name = exc_info[0].__name__
if exception_class_name != self.exception_class:
|