diff options
author | Matthias Bussonnier <bussonniermatthias@gmail.com> | 2019-05-28 07:10:59 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-28 07:10:59 (GMT) |
commit | 3880f263d2994fb1eba25835dddccb0cf696fdf0 (patch) | |
tree | 0c40e3b7cab9b3aa59600cec290548709d7c7dc4 /Lib | |
parent | 436c2b0d67da68465e709a96daac7340af3a5238 (diff) | |
download | cpython-3880f263d2994fb1eba25835dddccb0cf696fdf0.zip cpython-3880f263d2994fb1eba25835dddccb0cf696fdf0.tar.gz cpython-3880f263d2994fb1eba25835dddccb0cf696fdf0.tar.bz2 |
bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) (GH-13577)
It has been documented as deprecated and to be removed in 3.8;
From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`.
https://bugs.python.org/issue36933
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_coroutines.py | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index 036f13f..0e7eb3a 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -2146,99 +2146,6 @@ class CoroAsyncIOCompatTest(unittest.TestCase): self.assertEqual(buffer, [1, 2, 'MyException']) -class SysSetCoroWrapperTest(unittest.TestCase): - - def test_set_wrapper_1(self): - async def foo(): - return 'spam' - - wrapped = None - def wrap(gen): - nonlocal wrapped - wrapped = gen - return gen - - with self.assertWarns(DeprecationWarning): - self.assertIsNone(sys.get_coroutine_wrapper()) - - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(wrap) - with self.assertWarns(DeprecationWarning): - self.assertIs(sys.get_coroutine_wrapper(), wrap) - try: - f = foo() - self.assertTrue(wrapped) - - self.assertEqual(run_async(f), ([], 'spam')) - finally: - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(None) - f.close() - - with self.assertWarns(DeprecationWarning): - self.assertIsNone(sys.get_coroutine_wrapper()) - - wrapped = None - coro = foo() - self.assertFalse(wrapped) - coro.close() - - def test_set_wrapper_2(self): - with self.assertWarns(DeprecationWarning): - self.assertIsNone(sys.get_coroutine_wrapper()) - with self.assertRaisesRegex(TypeError, "callable expected, got int"): - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(1) - with self.assertWarns(DeprecationWarning): - self.assertIsNone(sys.get_coroutine_wrapper()) - - def test_set_wrapper_3(self): - async def foo(): - return 'spam' - - def wrapper(coro): - async def wrap(coro): - return await coro - return wrap(coro) - - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(wrapper) - try: - with silence_coro_gc(), self.assertRaisesRegex( - RuntimeError, - r"coroutine wrapper.*\.wrapper at 0x.*attempted to " - r"recursively wrap .* wrap .*"): - - foo() - - finally: - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(None) - - def test_set_wrapper_4(self): - @types.coroutine - def foo(): - return 'spam' - - wrapped = None - def wrap(gen): - nonlocal wrapped - wrapped = gen - return gen - - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(wrap) - try: - foo() - self.assertIs( - wrapped, None, - "generator-based coroutine was wrapped via " - "sys.set_coroutine_wrapper") - finally: - with self.assertWarns(DeprecationWarning): - sys.set_coroutine_wrapper(None) - - class OriginTrackingTest(unittest.TestCase): def here(self): info = inspect.getframeinfo(inspect.currentframe().f_back) |