2018-08-04 10:55:25 -07:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_serverextensions():
|
|
|
|
|
"""
|
|
|
|
|
Validate serverextensions we want are installed
|
|
|
|
|
"""
|
|
|
|
|
# jupyter-serverextension writes to stdout and stderr weirdly
|
2021-11-01 09:42:45 +01:00
|
|
|
proc = subprocess.run(
|
2021-11-03 23:55:34 +01:00
|
|
|
["/opt/tljh/user/bin/jupyter-serverextension", "list", "--sys-prefix"],
|
2021-11-01 09:42:45 +01:00
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
|
)
|
2018-08-04 10:55:25 -07:00
|
|
|
|
|
|
|
|
extensions = [
|
2023-08-01 06:28:39 +00:00
|
|
|
"jupyterlab",
|
2021-11-03 23:55:34 +01:00
|
|
|
"nbgitpuller 1.",
|
|
|
|
|
"jupyter_resource_usage",
|
2018-08-04 10:55:25 -07:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
for e in extensions:
|
2020-02-03 11:07:49 +02:00
|
|
|
assert e in proc.stderr.decode()
|
2018-08-04 10:55:25 -07:00
|
|
|
|
2021-11-01 09:42:45 +01:00
|
|
|
|
2023-08-01 06:43:49 +00:00
|
|
|
def test_labextensions():
|
2018-08-04 10:55:25 -07:00
|
|
|
"""
|
2023-08-01 06:43:49 +00:00
|
|
|
Validate JupyterLab extensions we want are installed & enabled
|
2018-08-04 10:55:25 -07:00
|
|
|
"""
|
2023-08-01 06:43:49 +00:00
|
|
|
# jupyter-labextension writes to stdout and stderr weirdly
|
2021-11-01 09:42:45 +01:00
|
|
|
proc = subprocess.run(
|
2023-08-01 06:43:49 +00:00
|
|
|
["/opt/tljh/user/bin/jupyter-labextension", "list"],
|
2021-11-01 09:42:45 +01:00
|
|
|
stderr=subprocess.PIPE,
|
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
|
)
|
2018-08-04 10:55:25 -07:00
|
|
|
|
|
|
|
|
extensions = [
|
2023-08-01 06:43:49 +00:00
|
|
|
"@jupyter-server/resource-usage",
|
|
|
|
|
# This is what ipywidgets lab extension is called
|
|
|
|
|
"@jupyter-widgets/jupyterlab-manager",
|
2018-08-04 10:55:25 -07:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
for e in extensions:
|
2021-11-03 23:55:34 +01:00
|
|
|
assert f"{e} \x1b[32m enabled \x1b[0m" in proc.stdout.decode()
|
2018-08-04 10:55:25 -07:00
|
|
|
|
|
|
|
|
# Ensure we have 'OK' messages in our stdout, to make sure everything is importable
|
2021-11-03 23:55:34 +01:00
|
|
|
assert proc.stderr.decode() == " - Validating: \x1b[32mOK\x1b[0m\n" * len(
|
2021-11-01 09:42:45 +01:00
|
|
|
extensions
|
|
|
|
|
)
|