[IronPython] False? with Unit Test

Curt Hagenlocher curt at hagenlocher.org
Sat Apr 5 19:16:10 CEST 2008


It's the call to sys.exit that does this.

There's a subtle difference between IronPython 2.0B1 and CPython 2.5 when
sys.exit is called with a boolean parameter.  CPython doesn't print the
value of the parameter if it's boolean, while IronPython does.  Presumably,
CPython does this for backwards compatibility with a time when it didn't
have a boolean data type. I'd guess that sys.exit(False) gets the same
behavior as sys.exit(0) while sys.exit(True) is the same as sys.exit(1).
But I haven't checked the CPython source to confirm that guess.

On Sat, Apr 5, 2008 at 6:06 AM, Davy Mitchell <daftspaniel at gmail.com> wrote:

> Hello List,
>
> Found a little funny on the latest IPY.
>
>     import unittest
>
>     class ATest(unittest.TestCase):
>         def setUp(self):
>             self.pop = ""
>         def test_blog(self):
>             print "test"
>
>     if __name__ == '__main__':
>         unittest.main()
>
> Runs fine but under IPY there's a extra line with 'False' output:
>
> test
> .
> --------------------------------------------------------------
> Ran one test in 0.096s
>
> OK
> False
>
> Anyone had more experience with this module?
>
> Davy
>
> --
> Davy Mitchell
> Blog - http://www.latedecember.co.uk/sites/personal/davy/
> Twitter - http://twitter.com/daftspaniel
> Skype - daftspaniel http://needgod.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080405/bf61362f/attachment.html>


More information about the Ironpython-users mailing list