Forbid creating of stream objects outside of asyncio (#13101)

This commit is contained in:
Andrew Svetlov 2019-05-06 22:52:11 -04:00 committed by GitHub
parent 2cc0223f43
commit ad4ed87241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 203 additions and 76 deletions

View file

@ -510,6 +510,18 @@ class SubprocessMixin:
self.loop.run_until_complete(execute())
def test_subprocess_protocol_create_warning(self):
with self.assertWarns(DeprecationWarning):
subprocess.SubprocessStreamProtocol(limit=10, loop=self.loop)
def test_process_create_warning(self):
proto = subprocess.SubprocessStreamProtocol(limit=10, loop=self.loop,
_asyncio_internal=True)
transp = mock.Mock()
with self.assertWarns(DeprecationWarning):
subprocess.Process(transp, proto, loop=self.loop)
if sys.platform != 'win32':
# Unix