summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-05-20 10:11:15 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-05-20 10:11:15 (GMT)
commit5a48e21ff163107a6f1788050b2f1ffc8bce2b6d (patch)
tree47b255b5bd985c762fe5fd2bb9e0beb828fdb986 /Lib/test/test_subprocess.py
parenta58e2c5c4928ae8031ee60a97f2ab4f863aff8cb (diff)
downloadcpython-5a48e21ff163107a6f1788050b2f1ffc8bce2b6d.zip
cpython-5a48e21ff163107a6f1788050b2f1ffc8bce2b6d.tar.gz
cpython-5a48e21ff163107a6f1788050b2f1ffc8bce2b6d.tar.bz2
subprocess now emits a ResourceWarning warning
Issue #26741: subprocess.Popen destructor now emits a ResourceWarning warning if the child process is still running.
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 5239e5a..a8f0a64 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -2286,7 +2286,9 @@ class POSIXProcessTestCase(BaseTestCase):
self.addCleanup(p.stderr.close)
ident = id(p)
pid = p.pid
- del p
+ with support.check_warnings(('', ResourceWarning)):
+ p = None
+
# check that p is in the active processes list
self.assertIn(ident, [id(o) for o in subprocess._active])
@@ -2305,7 +2307,9 @@ class POSIXProcessTestCase(BaseTestCase):
self.addCleanup(p.stderr.close)
ident = id(p)
pid = p.pid
- del p
+ with support.check_warnings(('', ResourceWarning)):
+ p = None
+
os.kill(pid, signal.SIGKILL)
# check that p is in the active processes list
self.assertIn(ident, [id(o) for o in subprocess._active])