Ticket #4747 defect reopened
tw.inet.test.ProcessTestsBuilder.test_openFileDescriptors is broken in many ways
| Reported by: | soyt | Owned by: | soyt |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | jessica.mckellar@… | Branch: | |
| Author: | Launchpad Bug: |
Description
The implementation of twisted.internet.process._listOpenFDs() is only a guess on some systems, with possible false positives. For example, on OpenBSD it returns something like range(64).
Furthermore, os.listdir() is not always used to return the fds, so the extra fd might not be there.
Finally, it seems that on some systems (guess what, OpenBSD!), for some reason, python internally uses a pair of interconnected pipes (I'll look further into this later) so there are actually more opened fds than just stdin, stdout and stderr.
So, as it is written the test makes little sense, and I am actually not sure what functionnality _listOpenFDs() really provides that is worth being tested.
Anyway, here is a patch that attempts to check that at least the three standard fds are there.

