Skip to content

Commit 7ca97bc

Browse files
author
Mateusz
committed
Fixes
1 parent 603caa8 commit 7ca97bc

File tree

2 files changed

+40
-68
lines changed

2 files changed

+40
-68
lines changed

.agent/todos/tool_call_fixes.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

tests/unit/test_test_quality.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ def test_ruff_linting_on_tests() -> None:
305305
if check_result.returncode == 0:
306306
return
307307

308-
# If there are issues, try to auto-fix them
309-
subprocess.run(
308+
# If there are issues, try to auto-fix them (safe fixes first)
309+
fix_result = subprocess.run(
310310
[
311311
sys.executable,
312312
"-m",
@@ -320,7 +320,7 @@ def test_ruff_linting_on_tests() -> None:
320320
cwd=project_root,
321321
)
322322

323-
# Check if auto-fix resolved all issues
323+
# Check if safe auto-fix resolved all issues
324324
final_check = subprocess.run(
325325
[
326326
sys.executable,
@@ -335,9 +335,45 @@ def test_ruff_linting_on_tests() -> None:
335335
cwd=project_root,
336336
)
337337

338+
# If safe fixes didn't resolve all issues, try unsafe fixes
339+
if final_check.returncode != 0:
340+
subprocess.run(
341+
[
342+
sys.executable,
343+
"-m",
344+
"ruff",
345+
"check",
346+
"--fix",
347+
"--unsafe-fixes",
348+
str(tests_dir),
349+
],
350+
capture_output=True,
351+
text=True,
352+
cwd=project_root,
353+
)
354+
355+
# Check again after unsafe fixes
356+
final_check = subprocess.run(
357+
[
358+
sys.executable,
359+
"-m",
360+
"ruff",
361+
"check",
362+
"--no-fix",
363+
str(tests_dir),
364+
],
365+
capture_output=True,
366+
text=True,
367+
cwd=project_root,
368+
)
369+
338370
# Only fail if there are still unfixable issues
339371
if final_check.returncode != 0:
340-
error_msg = f"ruff linting failed on tests directory (unfixable issues found):\n{final_check.stdout}\n{final_check.stderr}"
372+
error_msg = (
373+
f"ruff linting failed on tests directory (unfixable issues found):\n"
374+
f"{final_check.stdout}\n{final_check.stderr}\n"
375+
f"Fix attempt output:\n{fix_result.stdout}\n{fix_result.stderr}"
376+
)
341377
pytest.fail(error_msg)
342378

343379

0 commit comments

Comments
 (0)