diff options
Diffstat (limited to 'Lib/test/test_asyncio/test_subprocess.py')
-rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 81b08d6..428510f 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -29,6 +29,7 @@ class TestSubprocessTransport(base_subprocess.BaseSubprocessTransport): self._proc.stdin = None self._proc.stdout = None self._proc.stderr = None + self._proc.pid = -1 class SubprocessTransportTests(test_utils.TestCase): @@ -73,6 +74,29 @@ class SubprocessTransportTests(test_utils.TestCase): transport.close() + def test_subprocess_repr(self): + waiter = asyncio.Future(loop=self.loop) + transport, protocol = self.create_transport(waiter) + transport._process_exited(6) + self.loop.run_until_complete(waiter) + + self.assertEqual( + repr(transport), + "<TestSubprocessTransport pid=-1 returncode=6>" + ) + transport._returncode = None + self.assertEqual( + repr(transport), + "<TestSubprocessTransport pid=-1 running>" + ) + transport._pid = None + transport._returncode = None + self.assertEqual( + repr(transport), + "<TestSubprocessTransport not started>" + ) + transport.close() + class SubprocessMixin: |