summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest/save_env.py
diff options
context:
space:
mode:
authorBrett Cannon <brettcannon@users.noreply.github.com>2018-06-02 03:34:09 (GMT)
committerGitHub <noreply@github.com>2018-06-02 03:34:09 (GMT)
commit8425de4147eb8d83befbb8ea77516fc764bb4309 (patch)
treee07959e28d2c69c12aabd580ecb35e7a968783d3 /Lib/test/libregrtest/save_env.py
parentde6516264e793be991f692fdd892707afb9104a7 (diff)
downloadcpython-8425de4147eb8d83befbb8ea77516fc764bb4309.zip
cpython-8425de4147eb8d83befbb8ea77516fc764bb4309.tar.gz
cpython-8425de4147eb8d83befbb8ea77516fc764bb4309.tar.bz2
bpo-33562: Check the global asyncio event loop policy isn't set after any tests (GH-7328)
Diffstat (limited to 'Lib/test/libregrtest/save_env.py')
-rw-r--r--Lib/test/libregrtest/save_env.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py
index 45b365d..2313b71 100644
--- a/Lib/test/libregrtest/save_env.py
+++ b/Lib/test/libregrtest/save_env.py
@@ -1,3 +1,4 @@
+import asyncio
import builtins
import locale
import logging
@@ -65,8 +66,14 @@ class saved_test_environment:
'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
'files', 'locale', 'warnings.showwarning',
'shutil_archive_formats', 'shutil_unpack_formats',
+ 'asyncio.events._event_loop_policy',
)
+ def get_asyncio_events__event_loop_policy(self):
+ return support.maybe_get_event_loop_policy()
+ def restore_asyncio_events__event_loop_policy(self, policy):
+ asyncio.set_event_loop_policy(policy)
+
def get_sys_argv(self):
return id(sys.argv), sys.argv, sys.argv[:]
def restore_sys_argv(self, saved_argv):