Skip to content

Commit

Permalink
fix: importlib error (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Almenon authored Oct 23, 2022
1 parent c917a46 commit d927dd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ suite("python_evaluator Tests", () => {
default_filter_vars: [],
default_filter_types: ["<class 'module'>", "<class 'function'>"]
}
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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions python/arepl_python_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d927dd2

Please sign in to comment.