summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>2021-08-24 10:43:46 (GMT)
committerGitHub <noreply@github.com>2021-08-24 10:43:46 (GMT)
commit7179930ab5f5b2dea039023bec968aadc03e3775 (patch)
treeeb985724db8b546fb84fa1f3f937aa9e21fca3df
parentbb21e28fd08f894ceff2405544a2f257d42b1354 (diff)
downloadcpython-7179930ab5f5b2dea039023bec968aadc03e3775.zip
cpython-7179930ab5f5b2dea039023bec968aadc03e3775.tar.gz
cpython-7179930ab5f5b2dea039023bec968aadc03e3775.tar.bz2
bpo-43826: Fix resource warning due to unclosed objects. (GH-25381)
-rw-r--r--Lib/test/test_subprocess.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index f0f0e6f..94a95c7 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -719,6 +719,8 @@ class ProcessTestCase(BaseTestCase):
# However, this function is not yet in _winapi.
p.stdin.write(b"pear")
p.stdin.close()
+ p.stdout.close()
+ p.stderr.close()
finally:
p.kill()
p.wait()
@@ -746,6 +748,8 @@ class ProcessTestCase(BaseTestCase):
# On other platforms we cannot test the pipe size (yet). But above
# code using pipesize=-1 should not crash.
p.stdin.close()
+ p.stdout.close()
+ p.stderr.close()
finally:
p.kill()
p.wait()
@@ -3243,6 +3247,7 @@ class POSIXProcessTestCase(BaseTestCase):
with mock.patch.object(p, 'poll', new=lambda: None):
p.returncode = None
p.send_signal(signal.SIGTERM)
+ p.kill()
def test_communicate_repeated_call_after_stdout_close(self):
proc = subprocess.Popen([sys.executable, '-c',