diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2015-07-31 15:50:29 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2015-07-31 15:50:29 (GMT) |
| commit | 9591bf11d1852d323ca2c1231d129c9083ca6131 (patch) | |
| tree | dcf16173125841ebc6672a79fcb5d4d26f21b8db /Lib/test/test_asyncio/test_subprocess.py | |
| parent | daffc916aabb8424b6708039e64054f792fb660d (diff) | |
| parent | a7a4c41411026f5c049bb147425f6ce34c187bb6 (diff) | |
| download | cpython-9591bf11d1852d323ca2c1231d129c9083ca6131.zip cpython-9591bf11d1852d323ca2c1231d129c9083ca6131.tar.gz cpython-9591bf11d1852d323ca2c1231d129c9083ca6131.tar.bz2 | |
Merge 3.5 (asyncio)
Diffstat (limited to 'Lib/test/test_asyncio/test_subprocess.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index ea85e19..d138c26 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -1,6 +1,7 @@ import signal import sys import unittest +import warnings from unittest import mock import asyncio @@ -413,6 +414,20 @@ class SubprocessMixin: # the transport was not notified yet self.assertFalse(killed) + def test_popen_error(self): + # Issue #24763: check that the subprocess transport is closed + # when BaseSubprocessTransport fails + with mock.patch('subprocess.Popen') as popen: + exc = ZeroDivisionError + popen.side_effect = exc + + create = asyncio.create_subprocess_exec(sys.executable, '-c', + 'pass', loop=self.loop) + with warnings.catch_warnings(record=True) as warns: + with self.assertRaises(exc): + self.loop.run_until_complete(create) + self.assertEqual(warns, []) + if sys.platform != 'win32': # Unix |
