From a57e16e51c46048de98dc95c5b8cad84d1ac66c7 Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Tue, 15 Sep 2020 16:22:25 +0200 Subject: [PATCH] Work around jupyter/nbclient#85 --- ixmp/testing.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ixmp/testing.py b/ixmp/testing.py index dd1b8b2bf..4b6c88bed 100644 --- a/ixmp/testing.py +++ b/ixmp/testing.py @@ -359,6 +359,15 @@ def run_notebook(nb_path, tmp_path, env=None, kernel=None, allow_errors=False): import nbformat from nbclient import NotebookClient + # Workaround for https://github.com/jupyter/nbclient/issues/85 + if ( + sys.version_info[0] == 3 + and sys.version_info[1] >= 8 + and sys.platform.startswith("win") + ): + import asyncio + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + # Read the notebook with open(nb_path) as f: nb = nbformat.read(f, as_version=4)