[Python-Dev] [Python-checkins] r68547 - in python/trunk/Lib/test: test_datetime.py test_os.py

Kristján Valur Jónsson kristjan at ccpgames.com
Thu Jan 15 17:19:14 CET 2009

Well, all the other functions raise OSError when the file descriptor is invalid.  IOError usually means that the IO itself failed.
I wonder if it is platform specific?  Does it raise IOError on all platforms?
I can also change the test to test for IOError or OSError.

-----Original Message-----
From: Mark Dickinson [mailto:dickinsm at gmail.com] 
Sent: 15. janúar 2009 15:44
To: Kristján Valur Jónsson
Cc: Jean-Paul Calderone; python-dev at python.org
Subject: Re: [Python-Dev] [Python-checkins] r68547 - in python/trunk/Lib/test: test_datetime.py test_os.py

On Thu, Jan 15, 2009 at 9:13 AM, Kristján Valur Jónsson
<kristjan at ccpgames.com> wrote:
> However, these:
> ======================================================================
> ERROR: test_ftruncate (test.test_os.TestInvalidFD)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_os.py", line 570, in test_ftruncate
>    self.assertRaises(OSError, os.ftruncate, 10, 0)
>  File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 345, in failUnlessRaises
>    callableObj(*args, **kwargs)
> IOError: [Errno 9] Bad file descriptor

At the risk of stating the obvious, shouldn't you be checking for
IOError rather than OSError in assertRaises?


More information about the Python-Dev mailing list