Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
n8henrie committed Aug 30, 2024
1 parent c41a4a5 commit 1979feb
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 43 deletions.
1 change: 1 addition & 0 deletions src/jupyter_black/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Reexport used modules, main code will be in `jupyter_black.py`."""

__version__ = "v0.3.4"
__author__ = "Nathan Henrie"
__email__ = "[email protected]"
Expand Down
98 changes: 55 additions & 43 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ def all_cells_run(data: t.Union[bytes, str], expected_count: int) -> bool:
except (TypeError, KeyError):
return False

return all((
msg_type == "execute_reply",
execution_count == expected_count,
status == "ok",
))
return all(
(
msg_type == "execute_reply",
execution_count == expected_count,
status == "ok",
)
)


def is_closing(response: Response, port: int) -> bool:
Expand All @@ -146,11 +148,13 @@ def is_closing(response: Response, port: int) -> bool:
method = response.request.method
status_text = response.status_text

if all((
response.url.startswith(expected_url),
method == "DELETE",
status_text == "No Content",
)):
if all(
(
response.url.startswith(expected_url),
method == "DELETE",
status_text == "No Content",
)
):
response.finished()
return True
return False
Expand All @@ -164,11 +168,13 @@ def is_saved(response: Response, name: str, port: int) -> bool:
response_type = response.json().get("type")
except AttributeError:
return False
if all((
response.url.startswith(expected_url),
response_type == "notebook",
method == "PUT",
)):
if all(
(
response.url.startswith(expected_url),
response_type == "notebook",
method == "PUT",
)
):
response.finished()
return True
return False
Expand All @@ -188,10 +194,12 @@ def kernel_ready_event(data: t.Union[bytes, str]) -> bool:
except (TypeError, KeyError):
return False

return all((
msg_type == "kernel_info_reply",
status == "ok",
))
return all(
(
msg_type == "kernel_info_reply",
status == "ok",
)
)


def kernel_ready(ws: WebSocket) -> bool:
Expand Down Expand Up @@ -397,18 +405,20 @@ def jupyter_server(
port = open_port
tmp = tmp_path_factory.getbasetemp()
os.chdir(tmp)
proc = subprocess.Popen([
sys.executable,
"-m",
"jupyter",
"server",
"--ServerApp.config_file=/dev/null",
f"--ServerApp.port={port}",
"--ServerApp.port_retries=0",
"--ServerApp.token=''",
"--ServerApp.password=''",
"--no-browser",
])
proc = subprocess.Popen(
[
sys.executable,
"-m",
"jupyter",
"server",
"--ServerApp.config_file=/dev/null",
f"--ServerApp.port={port}",
"--ServerApp.port_retries=0",
"--ServerApp.token=''",
"--ServerApp.password=''",
"--no-browser",
]
)
context = browser.new_context()

def teardown() -> None:
Expand Down Expand Up @@ -445,18 +455,20 @@ def jupyter_lab(
port = open_port
tmp = tmp_path_factory.getbasetemp()
os.chdir(tmp)
proc = subprocess.Popen([
sys.executable,
"-m",
"jupyter",
"lab",
"--ServerApp.config_file=/dev/null",
f"--ServerApp.port={port}",
"--ServerApp.port_retries=0",
"--ServerApp.token=''",
"--ServerApp.password=''",
"--no-browser",
])
proc = subprocess.Popen(
[
sys.executable,
"-m",
"jupyter",
"lab",
"--ServerApp.config_file=/dev/null",
f"--ServerApp.port={port}",
"--ServerApp.port_retries=0",
"--ServerApp.token=''",
"--ServerApp.password=''",
"--no-browser",
]
)
context = browser.new_context()

def teardown() -> None:
Expand Down

0 comments on commit 1979feb

Please sign in to comment.