[Python-Dev] no test_posix, test_os or test_sys?

Thomas Wouters thomas@xs4all.net
Wed, 12 Jul 2000 16:58:52 +0200


On Wed, Jul 12, 2000 at 09:50:54AM -0500, Skip Montanaro wrote:

> I decided I better examine the posix.isatty patch assigned to me before
> Guido kicks me out...  I was a little annoyed it didn't include a new test
> case. 

I wasn't entirely certain how to test this. Can we rely on stdin/stdout
being a terminal, inside tests ? I think not. It can be tested by test_pty
and/or test_openpty, but then failure can mean two things: pty.openpty()
failed, or isatty() failed. Or we can open an fd and make sure os.isatty()
returns 0 for that. None of it seemed very sensible.

(I did write the test_pty/test_openpty modules with this in mind, though:

## # Please uncomment these if os.isatty() is added.
## if not os.isatty(master_fd):
##     raise TestFailed, "master_fd is not a tty"
## if not os.isatty(slave_fd):
##     raise TestFailed, "slave_fd is not a tty"

So if you accept the patch, please uncomment those lines ;)

However, isatty() is a *very* simple wrapper around a very basic C function,
so I didn't think it warranted a test case. (Like you pointed out, none of
the other functions in posixmodule have test cases.)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!