@@ -101,6 +101,7 @@ def test_stdin(self):
101101 self .assertTrue (flags & os .O_RDWR )
102102 self .assertTrue (info ['buf' ], 'TEST' )
103103 self .assertTrue (info ['flags' ] & os .O_RDWR )
104+ close_proc (proc )
104105
105106
106107class StdoutSockMixin (object ):
@@ -115,6 +116,7 @@ def test_stdout(self):
115116 self .assertTrue (flags & os .O_RDWR )
116117 self .assertTrue (buf , 'TEST' )
117118 self .assertTrue (info ['flags' ] & os .O_RDWR )
119+ close_proc (proc )
118120
119121
120122class CreateChildTest (StdinSockMixin , StdoutSockMixin , testlib .TestCase ):
@@ -126,6 +128,7 @@ def test_stderr(self):
126128 self .assertEqual (st .st_dev , info ['st_dev' ])
127129 self .assertEqual (st .st_mode , info ['st_mode' ])
128130 self .assertEqual (st .st_ino , info ['st_ino' ])
131+ close_proc (proc )
129132
130133
131134class CreateChildMergedTest (StdinSockMixin , StdoutSockMixin ,
@@ -144,6 +147,7 @@ def test_stderr(self):
144147 self .assertTrue (flags & os .O_RDWR )
145148 self .assertTrue (buf , 'TEST' )
146149 self .assertTrue (info ['flags' ] & os .O_RDWR )
150+ close_proc (proc )
147151
148152
149153class CreateChildStderrPipeTest (StdinSockMixin , StdoutSockMixin ,
@@ -164,6 +168,7 @@ def test_stderr(self):
164168 self .assertFalse (flags & os .O_RDWR )
165169 self .assertTrue (buf , 'TEST' )
166170 self .assertTrue (info ['flags' ] & os .O_WRONLY )
171+ close_proc (proc )
167172
168173
169174class TtyCreateChildTest (testlib .TestCase ):
@@ -191,9 +196,9 @@ def test_dev_tty_open_succeeds(self):
191196 self .assertEqual (proc .pid , waited_pid )
192197 self .assertEqual (0 , status )
193198 self .assertEqual (mitogen .core .b ('' ), tf .read ())
194- proc .stdout .close ()
195199 finally :
196200 tf .close ()
201+ close_proc (proc )
197202
198203 def test_stdin (self ):
199204 proc , info , _ = run_fd_check (self .func , 0 , 'read' ,
@@ -210,6 +215,7 @@ def test_stdin(self):
210215 self .assertTrue (flags & os .O_RDWR )
211216 self .assertTrue (info ['flags' ] & os .O_RDWR )
212217 self .assertTrue (info ['buf' ], 'TEST' )
218+ close_proc (proc )
213219
214220 def test_stdout (self ):
215221 proc , info , buf = run_fd_check (self .func , 1 , 'write' ,
@@ -229,6 +235,7 @@ def test_stdout(self):
229235
230236 self .assertTrue (flags & os .O_RDWR )
231237 self .assertTrue (buf , 'TEST' )
238+ close_proc (proc )
232239
233240 def test_stderr (self ):
234241 # proc.stderr is None in the parent since there is no separate stderr
@@ -250,6 +257,7 @@ def test_stderr(self):
250257
251258 self .assertTrue (flags & os .O_RDWR )
252259 self .assertTrue (buf , 'TEST' )
260+ close_proc (proc )
253261
254262 def test_dev_tty_open_succeeds (self ):
255263 # In the early days of UNIX, a process that lacked a controlling TTY
@@ -274,6 +282,7 @@ def test_dev_tty_open_succeeds(self):
274282 proc .stdout .close ()
275283 finally :
276284 tf .close ()
285+ close_proc (proc )
277286
278287
279288class StderrDiagTtyMixin (object ):
@@ -296,6 +305,7 @@ def test_stderr(self):
296305
297306 self .assertTrue (flags & os .O_RDWR )
298307 self .assertTrue (buf , 'TEST' )
308+ close_proc (proc )
299309
300310
301311class HybridTtyCreateChildTest (StdinSockMixin , StdoutSockMixin ,
@@ -321,6 +331,7 @@ def test_stdin(self):
321331 self .assertTrue (buf , 'TEST' )
322332 self .assertFalse (info ['flags' ] & os .O_WRONLY )
323333 self .assertFalse (info ['flags' ] & os .O_RDWR )
334+ close_proc (proc )
324335
325336 def test_stdout (self ):
326337 proc , info , buf = run_fd_check (self .func , 1 , 'write' ,
@@ -334,3 +345,4 @@ def test_stdout(self):
334345 self .assertFalse (flags & os .O_RDWR )
335346 self .assertTrue (info ['flags' ] & os .O_WRONLY )
336347 self .assertTrue (buf , 'TEST' )
348+ close_proc (proc )
0 commit comments