From 5fc36addbbda855f88a38a6dc31c95dafc1c40d2 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 6 Aug 2026 10:49:40 +0100 Subject: [PATCH] fix: Allow tests to pass again under ruff 0.16.x ruff 0.16.0 removed rule `E402` from its default rule set (among other rules). This broke these two tests, which assumes this rule is part of the default set. Update the tests to explicitly configure these `E402`, so they can be asserted on at the end. We also go ahead and do the same for the rest of the rules these tests expect, so that they don't quietly break later on. --- tests/test_ruff_lint.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_ruff_lint.py b/tests/test_ruff_lint.py index 52ef6a5..aaca79b 100644 --- a/tests/test_ruff_lint.py +++ b/tests/test_ruff_lint.py @@ -160,12 +160,13 @@ def get_ruff_settings(workspace, doc, config_str): def test_ruff_settings(workspace): config_str = r"""[tool.ruff] +select = ["E402", "F401", "F841"] ignore = ["F841"] exclude = [ "blah/__init__.py", "file_2.py" ] -extend-select = ["D"] +extend-select = ["D103", "D104"] [tool.ruff.per-file-ignores] "test_something.py" = ["F401"] """ @@ -277,6 +278,11 @@ def f(): def test_notebook_input(workspace): + # Explicitly enable the rules we're expecting to find. + workspace._config.update( + {"plugins": {"ruff": {"select": ["E402", "F401", "F841"]}}} + ) + doc_str = r""" print('hi') import os