Uploaded a new version of the patch.
Changelog of this patch (compared to v3):
* Fixed reliability issue of existing pty tests.
* pty.fork() should now also work on systems without os.forkpty(). Added code to test this backup path of pty.fork().
* Reverted my flawed changes to pty.py (broken pipe).
* All new tests which produce output in the pty.spawn()ed child have the terminal in a well-defined state w.r.t. termios.
* Subtle renaming: PtyTest is now PtyBasicTest. The reason is to execute it before the integration tests. All tests are independent and the order is irrelevant, but if something fails on a platform, it is easier to debug if we run the unit tests before we go to the integration tests.
* Improved, cleaned, documented, and restructured test code. Thank you Xavier and Martin for your very helpful feedback :-)
I also added some small comments in the code review tool.