Unit Test Failures Do Not Include String Arguments Passed to Test s

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unit Test Failures Do Not Include String Arguments Passed to Test s

Jones, Larry
Message
The following script
 
import unittest
 

class MyTest(unittest.TestCase):
 
    def testFirst(self):
        self.failUnless(False, 'first')
 
    def testSecond(self):
        self.failIf(False, 'second')
 

def suite():
    theSuite = unittest.makeSuite(MyTest, 'test')
    return theSuite;
 
if __name__ == '__main__':
    unittest.TextTestRunner().run(suite())
   
 
produces the following output in Python 2.4
 
$ python unittesterror.py
F.
======================================================================
FAIL: testFirst (__main__.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "unittesterror.py", line 7, in testFirst
    self.failUnless(False, 'first')
AssertionError: first
 
----------------------------------------------------------------------
Ran 2 tests in 0.000s
 
FAILED (failures=1)
 
(In particular, it contains the text 'first' supported to the assertion.)
 
Executing under IronPython, the output is:
 
$ /usr/local/bin/ironpython/IronPythonConsole.exe unittesterror.py
F.
======================================================================
FAIL: testFirst (__main__.MyTest)
----------------------------------------------------------------------
<type 'AssertionError'>: IronPython.Runtime.PythonAssertionError: AssertionError
   at IronPython.Runtime.Ops.Raise(Object type, Object value, Object traceback)
   at unittest.failUnless$f32(Object self, Object expr, Object msg) in c:\Python24\Lib\unittest.py:line 309
   at IronPython.Runtime.Function3.Call(Object arg0, Object arg1, Object arg2)
   at IronPython.Runtime.Ops.Call(Object func, Object arg0, Object arg1, Object arg2)
   at IronPython.Runtime.Method.Call(Object arg0, Object arg1)
   at IronPython.Runtime.Ops.CallWithContext(ICallerContext context, Object func, Object arg0, Object arg1)
   at __main__.testFirst$f0(Object self) in c:\usr\home\jonesl\Employee\Current\ProductDir\ResearchAndDevelopment\als_security\p
roto_azn\unittesterror.py:line 7
   at IronPython.Runtime.Function1.Call(Object arg0)
   at IronPython.Runtime.Ops.Call(Object func, Object arg0)
   at IronPython.Runtime.Method.Call()
   at IronPython.Runtime.Ops.CallWithContext(ICallerContext context, Object func)
   at unittest.run$f26(Object self, Object result) in c:\Python24\Lib\unittest.py:line 260
 
----------------------------------------------------------------------
Ran 2 tests in 0.172s
 
FAILED (failures=1)
 
In particular, the string argument is not present in the output.
 
I have submitted this behavior as a bug.
 

--

Lawrence Allan Jones
Senior Developer / Technical Advisor
Aspen Technology, Inc.
2500 CityWest Blvd. Suite 1500
Houston, Texas 77042
USA
281-504-3324 (work)
281-504-3395 (fax)
[hidden email]
www.aspentech.com

 

This e-mail and any attachments are intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified any dissemination, distribution or copying of this email, and any attachments thereto, is strictly prohibited. If you receive this email in error please immediately notify the sender and permanently delete the original copy and any copy of any e-mail, and any printout thereof.


_______________________________________________
users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

email_2_03.gif (2K) Download Attachment
email_2_04.gif (276 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unit Test Failures Do Not Include String Arguments Passed to Test s

Dino Viehland-3
Thanks for the bug report.  This is something that may be rather difficult to fix so I don't know that we'll get to it anytime too soon but it's good to track these little differences.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jones, Larry
Sent: Tuesday, January 24, 2006 7:35 AM
To: '[hidden email]'
Subject: [IronPython] Unit Test Failures Do Not Include String Arguments Passed to Test s

The following script
 
import unittest
 

class MyTest(unittest.TestCase):
 
    def testFirst(self):
        self.failUnless(False, 'first')
 
    def testSecond(self):
        self.failIf(False, 'second')
 

def suite():
    theSuite = unittest.makeSuite(MyTest, 'test')
    return theSuite;
 
if __name__ == '__main__':
    unittest.TextTestRunner().run(suite())
   
 
produces the following output in Python 2.4
 
$ python unittesterror.py
F.
======================================================================
FAIL: testFirst (__main__.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "unittesterror.py", line 7, in testFirst
    self.failUnless(False, 'first')
AssertionError: first
 
----------------------------------------------------------------------
Ran 2 tests in 0.000s
 
FAILED (failures=1)
 
(In particular, it contains the text 'first' supported to the assertion.)
 
Executing under IronPython, the output is:
 
$ /usr/local/bin/ironpython/IronPythonConsole.exe unittesterror.py
F.
======================================================================
FAIL: testFirst (__main__.MyTest)
----------------------------------------------------------------------
<type 'AssertionError'>: IronPython.Runtime.PythonAssertionError: AssertionError
   at IronPython.Runtime.Ops.Raise(Object type, Object value, Object traceback)
   at unittest.failUnless$f32(Object self, Object expr, Object msg) in c:\Python24\Lib\unittest.py:line 309
   at IronPython.Runtime.Function3.Call(Object arg0, Object arg1, Object arg2)
   at IronPython.Runtime.Ops.Call(Object func, Object arg0, Object arg1, Object arg2)
   at IronPython.Runtime.Method.Call(Object arg0, Object arg1)
   at IronPython.Runtime.Ops.CallWithContext(ICallerContext context, Object func, Object arg0, Object arg1)
   at __main__.testFirst$f0(Object self) in c:\usr\home\jonesl\Employee\Current\ProductDir\ResearchAndDevelopment\als_security\p
roto_azn\unittesterror.py:line 7
   at IronPython.Runtime.Function1.Call(Object arg0)
   at IronPython.Runtime.Ops.Call(Object func, Object arg0)
   at IronPython.Runtime.Method.Call()
   at IronPython.Runtime.Ops.CallWithContext(ICallerContext context, Object func)
   at unittest.run$f26(Object self, Object result) in c:\Python24\Lib\unittest.py:line 260
 
----------------------------------------------------------------------
Ran 2 tests in 0.172s
 
FAILED (failures=1)
 
In particular, the string argument is not present in the output.
 
I have submitted this behavior as a bug.
 
--

Lawrence Allan Jones
Senior Developer / Technical Advisor
Aspen Technology, Inc.
2500 CityWest Blvd. Suite 1500
Houston, Texas 77042
USA
281-504-3324 (work)
281-504-3395 (fax)
[hidden email]
www.aspentech.com <http://www.aspentech.com/>

 <http://www.aspentech.com/signature/email_2_03.gif>
 <http://www.aspentech.com/signature/email_2_04.gif>
 

This e-mail and any attachments are intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified any dissemination, distribution or copying of this email, and any attachments thereto, is strictly prohibited. If you receive this email in error please immediately notify the sender and permanently delete the original copy and any copy of any e-mail, and any printout thereof.

_______________________________________________
users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com