From 95798620a5b3d8b69e7e03f895c4e2bf7227677c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 9 Nov 2023 10:19:36 -0600 Subject: [PATCH] Clean up ruff config (#1358) --- .pre-commit-config.yaml | 4 +++- pyproject.toml | 6 ++++-- tests/services/kernels/test_api.py | 2 ++ tests/services/sessions/test_api.py | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index faf4a54504..6ea5ed59ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,11 +67,13 @@ repos: ["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.4 + rev: v0.1.5 hooks: - id: ruff + types_or: [python, jupyter] args: ["--fix", "--show-fixes"] - id: ruff-format + types_or: [python, jupyter] - repo: https://github.com/scientific-python/cookie rev: "2023.10.27" diff --git a/pyproject.toml b/pyproject.toml index 0f7b639828..523e2fbab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,7 +116,10 @@ integration = "test --integration_tests=true {args}" detached = true dependencies = ["pre-commit"] [tool.hatch.envs.lint.scripts] -build = "pre-commit run --all-files ruff" +build = [ + "pre-commit run --all-files ruff", + "pre-commit run --all-files ruff-format", +] [tool.hatch.version] path = "jupyter_server/_version.py" @@ -137,7 +140,6 @@ install-pre-commit-hook = true optional-editable-build = true [tool.ruff] -target-version = "py38" line-length = 100 [tool.ruff.lint] diff --git a/tests/services/kernels/test_api.py b/tests/services/kernels/test_api.py index dfbf1a47bc..60009e8978 100644 --- a/tests/services/kernels/test_api.py +++ b/tests/services/kernels/test_api.py @@ -7,6 +7,7 @@ import jupyter_client import pytest import tornado +from flaky import flaky from jupyter_client.kernelspec import NATIVE_KERNEL_NAME from tornado.httpclient import HTTPClientError @@ -256,6 +257,7 @@ async def test_kernel_handler_startup_error_pending( await jp_ws_fetch("api", "kernels", kid, "channels") +@flaky @pytest.mark.timeout(TEST_TIMEOUT) async def test_connection(jp_fetch, jp_ws_fetch, jp_http_port, jp_auth_header): # Create kernel diff --git a/tests/services/sessions/test_api.py b/tests/services/sessions/test_api.py index edc0e63529..8c46de9470 100644 --- a/tests/services/sessions/test_api.py +++ b/tests/services/sessions/test_api.py @@ -9,6 +9,7 @@ import jupyter_client import pytest import tornado +from flaky import flaky from jupyter_client.ioloop import AsyncIOLoopKernelManager from nbformat import writes from nbformat.v4 import new_notebook @@ -506,6 +507,7 @@ async def test_modify_kernel_id(session_client, jp_fetch, jp_serverapp, session_ assert kernel_list == [kernel] +@flaky @pytest.mark.timeout(TEST_TIMEOUT) async def test_restart_kernel(session_client, jp_base_url, jp_fetch, jp_ws_fetch, session_is_ready): # Create a session.