cpython: a7381fe515e8 (original) (raw)
Mercurial > cpython
changeset 84080:a7381fe515e8 2.7
Issue #18174: Fix fd leaks in tests. [#18174]
Richard Oudkerk shibturn@gmail.com | |
---|---|
date | Mon, 10 Jun 2013 16:27:45 +0100 |
parents | 4d1e4bc6c5b5 |
children | 73de0794ae71 |
files | Lib/test/test_openpty.py Lib/test/test_subprocess.py Lib/test/test_uuid.py |
diffstat | 3 files changed, 5 insertions(+), 1 deletions(-)[+] [-] Lib/test/test_openpty.py 2 Lib/test/test_subprocess.py 3 Lib/test/test_uuid.py 1 |
line wrap: on
line diff
--- a/Lib/test/test_openpty.py +++ b/Lib/test/test_openpty.py @@ -10,6 +10,8 @@ if not hasattr(os, "openpty"): class OpenptyTest(unittest.TestCase): def test(self): master, slave = os.openpty()
self.addCleanup(os.close, master)[](#l1.7)
self.addCleanup(os.close, slave)[](#l1.8) if not os.isatty(slave):[](#l1.9) self.fail("Slave-end of pty is not a terminal.")[](#l1.10)
--- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -806,7 +806,8 @@ class POSIXProcessTestCase(BaseTestCase) self._testcase.assertNotIn( fd, (p2cwrite, c2pread, errread)) finally:
map(os.close, devzero_fds)[](#l2.7)
for fd in devzero_fds:[](#l2.8)
os.close(fd)[](#l2.9)
@unittest.skipIf(not os.path.exists("/dev/zero"), "/dev/zero required.") def test_preexec_errpipe_does_not_double_close_pipes(self):
--- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -448,6 +448,7 @@ class TestUUID(unittest.TestCase): else: os.close(fds[1])
self.addCleanup(os.close, fds[0])[](#l3.7) parent_value = uuid.uuid4().hex[](#l3.8) os.waitpid(pid, 0)[](#l3.9) child_value = os.read(fds[0], 100)[](#l3.10)