From d927dd20c1f80b5c6e66a0c965ecc1d2d91168d9 Mon Sep 17 00:00:00 2001 From: Almenon Date: Sat, 22 Oct 2022 21:47:56 -0700 Subject: [PATCH] fix: importlib error (#184) see https://github.com/Almenon/AREPL-vscode/issues/416 --- index.test.ts | 13 ++++++++++--- python/arepl_python_evaluator.py | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/index.test.ts b/index.test.ts index 0fc053a..c6ac1a1 100644 --- a/index.test.ts +++ b/index.test.ts @@ -24,9 +24,7 @@ suite("python_evaluator Tests", () => { default_filter_vars: [], default_filter_types: ["", ""] } - const pythonStartupTime = 3500 - // python 3.7 has much faster startup time - // when we drop support for 3.6 we can decrease this + const pythonStartupTime = 3000 suiteSetup(function (done) { this.timeout(pythonStartupTime + 500) @@ -69,6 +67,15 @@ suite("python_evaluator Tests", () => { pyEvaluator.execCode(input) }) + test("can import importlib", function (done) { + pyEvaluator.onResult = (result) => { + assert.strictEqual(result.userErrorMsg, undefined) + done() + } + input.evalCode = "import importlib.resources as rsrc" + pyEvaluator.execCode(input) + }) + test("returns user variables properly when there is a lot of content", function (done) { pyEvaluator.onResult = (result) => { assert.strictEqual(result.userVariables['x'], 1) diff --git a/python/arepl_python_evaluator.py b/python/arepl_python_evaluator.py index 2653574..73281dc 100644 --- a/python/arepl_python_evaluator.py +++ b/python/arepl_python_evaluator.py @@ -25,6 +25,7 @@ "arepl_jsonpickle.ext.pandas", "arepl_jsonpickle.ext.numpy", "typing", # for some reason i can't clear this or jsonpickle breaks + "typing.io", # if this gets cleared then py 3.8 & 3.10 breaks ) ) # when arepl is ran via unit test/debugging some extra libraries might be in modules_to_keep