diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-05-08 14:49:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 14:49:09 (GMT) |
commit | 086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0 (patch) | |
tree | a7b1eaf75879c3fded1b946b2331f6a45dfc8fc7 /Lib/test/test_poll.py | |
parent | 8f293180791f2836570bdfc29aadba04a538d435 (diff) | |
download | cpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.zip cpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.tar.gz cpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.tar.bz2 |
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
Diffstat (limited to 'Lib/test/test_poll.py')
-rw-r--r-- | Lib/test/test_poll.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py index 7d542b5..02165a0 100644 --- a/Lib/test/test_poll.py +++ b/Lib/test/test_poll.py @@ -128,8 +128,7 @@ class PollTests(unittest.TestCase): cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, bufsize=0) - proc.__enter__() - self.addCleanup(proc.__exit__, None, None, None) + self.enterContext(proc) p = proc.stdout pollster = select.poll() pollster.register( p, select.POLLIN ) |