Skip to content

Commit e95be9a

Browse files
committed
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.
1 parent 00356b4 commit e95be9a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tests/test_ruff_lint.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,13 @@ def get_ruff_settings(workspace, doc, config_str):
160160

161161
def test_ruff_settings(workspace):
162162
config_str = r"""[tool.ruff]
163+
select = ["E402", "F401", "F841"]
163164
ignore = ["F841"]
164165
exclude = [
165166
"blah/__init__.py",
166167
"file_2.py"
167168
]
168-
extend-select = ["D"]
169+
extend-select = ["D103", "D104"]
169170
[tool.ruff.per-file-ignores]
170171
"test_something.py" = ["F401"]
171172
"""
@@ -277,6 +278,9 @@ def f():
277278

278279

279280
def test_notebook_input(workspace):
281+
workspace._config.update(
282+
{"plugins": {"ruff": {"select": ["E402", "F401", "F841"]}}}
283+
)
280284
doc_str = r"""
281285
print('hi')
282286
import os

0 commit comments

Comments
 (0)