diff --git a/pyproject.toml b/pyproject.toml index 5d83c0f0f..94cef1453 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ include = ["/uvicorn"] select = ["E", "F", "I"] ignore = ["B904", "B028"] -[tool.ruff.isort] +[tool.ruff.lint.isort] combine-as-imports = true [tool.mypy] diff --git a/requirements.txt b/requirements.txt index ab8274208..1ac571f9b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,8 +14,7 @@ build==1.0.3 twine==4.0.2 # Testing -black==23.7.0 -ruff==0.0.286 +ruff==0.1.4 pytest==7.4.3 pytest-mock==3.11.1 mypy==1.6.1 diff --git a/scripts/check b/scripts/check index e8567468b..15748a4e8 100755 --- a/scripts/check +++ b/scripts/check @@ -10,7 +10,7 @@ export SOURCE_FILES="uvicorn tests" set -x ./scripts/sync-version -${PREFIX}black --check --diff --target-version=py38 $SOURCE_FILES +${PREFIX}ruff format --check --diff $SOURCE_FILES ${PREFIX}mypy $SOURCE_FILES ${PREFIX}ruff check $SOURCE_FILES ${PREFIX}python -m tools.cli_usage --check diff --git a/scripts/lint b/scripts/lint index 9f0cacd2c..2b6904b3c 100755 --- a/scripts/lint +++ b/scripts/lint @@ -9,6 +9,6 @@ export SOURCE_FILES="uvicorn tests" set -x -${PREFIX}black --target-version=py38 $SOURCE_FILES +${PREFIX}ruff format $SOURCE_FILES ${PREFIX}ruff --fix $SOURCE_FILES ${PREFIX}python -m tools.cli_usage diff --git a/tests/protocols/test_websocket.py b/tests/protocols/test_websocket.py index 9f98e3c7b..64bda3450 100644 --- a/tests/protocols/test_websocket.py +++ b/tests/protocols/test_websocket.py @@ -71,15 +71,18 @@ def app(scope): pass # ok, wsproto 0.13 else: assert response.status_code == 400 - assert response.text.lower().strip().rstrip(".") in [ - "missing sec-websocket-key header", - "missing sec-websocket-version header", # websockets - "missing or empty sec-websocket-key header", # wsproto - "failed to open a websocket connection: missing " - "sec-websocket-key header", - "failed to open a websocket connection: missing or empty " - "sec-websocket-key header", - ] + assert ( + response.text.lower().strip().rstrip(".") + in [ + "missing sec-websocket-key header", + "missing sec-websocket-version header", # websockets + "missing or empty sec-websocket-key header", # wsproto + "failed to open a websocket connection: missing " + "sec-websocket-key header", + "failed to open a websocket connection: missing or empty " + "sec-websocket-key header", + ] + ) @pytest.mark.anyio diff --git a/tests/test_config.py b/tests/test_config.py index 17ab097e6..200e88dc6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -97,10 +97,9 @@ def test_reload_dir_is_set( app="tests.test_config:asgi_app", reload=True, reload_dirs=[str(app_dir)] ) assert len(caplog.records) == 1 - assert ( - caplog.records[-1].message - == f"Will watch for changes in these directories: {[str(app_dir)]}" - ) + assert caplog.records[ + -1 + ].message == f"Will watch for changes in these directories: {[str(app_dir)]}" assert config.reload_dirs == [app_dir] config = Config( app="tests.test_config:asgi_app", reload=True, reload_dirs=str(app_dir)