Skip to content

Commit

Permalink
Use pytest-jupyter (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Dec 8, 2022
1 parent efa7ed7 commit ee8db6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jupyterlab_server/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from jupyterlab_server import LabServerApp

pytest_plugins = ["jupyter_server.pytest_plugin"]
pytest_plugins = ["pytest_jupyter.jupyter_server"]


def mkdir(tmp_path, *parts):
Expand Down
8 changes: 4 additions & 4 deletions jupyterlab_server/workspaces_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ def start(self):
workspaces = self.manager.list_workspaces()
if self.jsonlines:
for workspace in workspaces:
self.log.info(json.dumps(workspace))
print(json.dumps(workspace)) # noqa
elif self.json:
self.log.info(json.dumps(workspaces))
print(json.dumps(workspaces)) # noqa
else:
for workspace in workspaces:
self.log.info(workspace["metadata"]["id"])
print(workspace["metadata"]["id"]) # noqa


class WorkspaceExportApp(JupyterApp, LabConfig):
Expand All @@ -92,7 +92,7 @@ def start(self):
raw = DEFAULT_WORKSPACE if not self.extra_args else self.extra_args[0]
try:
workspace = self.manager.load(raw)
self.log.info(json.dumps(workspace))
print(json.dumps(workspace)) # noqa
except Exception: # pragma: no cover
self.log.error(json.dumps(dict(data=dict(), metadata=dict(id=raw))))

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Typing :: Typed"]
requires-python = ">=3.7"
dependencies = [
Expand All @@ -29,7 +30,7 @@ dependencies = [
"jinja2>=3.0.3",
"json5>=0.9.0",
"jsonschema>=3.0.1",
"jupyter_server>=1.8,<3",
"jupyter_server>=1.21,<3",
"packaging>=21.3",
"requests>=2.28",
]
Expand Down Expand Up @@ -68,14 +69,15 @@ openapi = [
test = [
"codecov",
"ipykernel",
"jupyter_server[test]",
"pytest-jupyter[server]>=0.6",
# openapi_core 0.15.0 alpha is not working
"openapi_core~=0.14.2",
"openapi-spec-validator<0.6",
"requests_mock",
"pytest>=7.0",
"pytest-console-scripts",
"pytest-cov",
"pytest-timeout",
"ruamel.yaml",
"strict-rfc3339"
]
Expand Down

0 comments on commit ee8db6a

Please sign in to comment.