forked from jupyterlite/xeus-python-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_xeus_python_env.py
33 lines (22 loc) · 1.02 KB
/
test_xeus_python_env.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Test creating Python envs for jupyterlite-xeus-python."""
import os
from tempfile import TemporaryDirectory
from pathlib import Path
from jupyterlite.app import LiteStatusApp
from jupyterlite_xeus_python.env_build_addon import XeusPythonEnv, JUPYTERLITE_XEUS_PYTHON_DEBUG
def test_python_env():
app = LiteStatusApp(log_level="DEBUG")
app.initialize()
manager = app.lite_manager
addon = XeusPythonEnv(manager)
addon.packages = ["numpy", "ipyleaflet"]
os.environ[JUPYTERLITE_XEUS_PYTHON_DEBUG] = "True"
for step in addon.post_build(manager):
pass
# Check env
assert os.path.isdir("/tmp/xeus-python-kernel/envs/xeus-python-kernel")
assert os.path.isfile("/tmp/xeus-python-kernel/envs/xeus-python-kernel/bin/xpython_wasm.js")
assert os.path.isfile("/tmp/xeus-python-kernel/envs/xeus-python-kernel/bin/xpython_wasm.wasm")
# Check empack output
assert os.path.isfile(Path(addon.cwd.name) / "python_data.js")
assert os.path.isfile(Path(addon.cwd.name) / "python_data.data")