Repository: nbQA-dev/nbQA (language: python)

Issue:
test_ruff_works fails with latest ruff (0.5.0)
This is the result of running the nbqa test suite with the latest ruff installed:
```
=========================== short test summary info ============================
FAILED tests/tools/test_ruff_works.py::test_ruff_works[/build/source/tests/data/notebook_for_testing.ipynb-/build/source/tests/data/notebook_for_testing_copy.ipynb-/build/source/tests/data/notebook_starting_with_md.ipynb] - AssertionError: assert '\n\n\n\n\n\n...ed but unused' == 'Found 13 err...ed...
FAILED tests/tools/test_ruff_works.py::test_ruff_works[tests/data/notebook_for_testing.ipynb-tests/data/notebook_for_testing_copy.ipynb-tests/data/notebook_starting_with_md.ipynb] - AssertionError: assert '\n\n\n\n\n\n...ed but unused' == 'Found 13 err...ed...
=========== 2 failed, 98 passed, 3 skipped, 14 deselected in 20.74s ============
```


Discussion / hints:
thanks @GaetanLepage for the report

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ee972d99..8eff792f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,7 +8,7 @@ repos:
       - id: trailing-whitespace
       - id: debug-statements
   - repo: https://github.com/pre-commit/pre-commit
-    rev: v3.7.0
+    rev: v3.8.0
     hooks:
       - id: validate_manifest
   - repo: https://github.com/hauntsaninja/black-pre-commit-mirror
@@ -17,13 +17,13 @@ repos:
     hooks:
       - id: black
   - repo: https://github.com/PyCQA/pylint
-    rev: v3.1.0
+    rev: v3.2.6
     hooks:
       - id: pylint
         files: ^(nbqa|tests)/
         exclude: ^tests/data/
   - repo: https://github.com/PyCQA/flake8
-    rev: 7.0.0
+    rev: 7.1.0
     hooks:
       - id: flake8
         additional_dependencies: [flake8-typing-imports==1.14.0]
@@ -38,13 +38,13 @@ repos:
       - id: pydocstyle
         files: ^nbqa/
   - repo: https://github.com/pre-commit/mirrors-mypy
-    rev: v1.10.0
+    rev: v1.11.0
     hooks:
       - id: mypy
         exclude: ^docs/
         additional_dependencies: [types-setuptools, types-toml]
   - repo: https://github.com/asottile/pyupgrade
-    rev: v3.15.2
+    rev: v3.17.0
     hooks:
       - id: pyupgrade
         args: [--py38-plus]
@@ -53,7 +53,7 @@ repos:
     hooks:
       - id: auto-walrus
   - repo: https://github.com/codespell-project/codespell
-    rev: v2.2.6
+    rev: v2.3.0
     hooks:
       - id: codespell
         files: \.(py|rst|md)$


Test patch:
diff --git a/tests/tools/test_pylint_works.py b/tests/tools/test_pylint_works.py
index 513b2838..2c0d5748 100644
--- a/tests/tools/test_pylint_works.py
+++ b/tests/tools/test_pylint_works.py
@@ -34,6 +34,7 @@ def test_pylint_works(capsys: "CaptureFixture") -> None:
         f'{notebook1}:cell_4:1:0: C0413: Import "from random import randint" should be placed at the top of the module (wrong-import-position)\n'  # noqa: E501
         f'{notebook1}:cell_5:1:0: C0413: Import "import pprint" should be placed at the top of the module (wrong-import-position)\n'  # noqa: E501
         f'{notebook1}:cell_5:2:0: C0413: Import "import sys" should be placed at the top of the module (wrong-import-position)\n'  # noqa: E501
+        f"{notebook1}:cell_5:9:0: E0606: Possibly using variable 'pretty_print_object' before assignment (possibly-used-before-assignment)\n"  # noqa: E501
         f'{notebook1}:cell_4:1:0: C0411: standard import "random.randint" should be placed before first party import "nbqa"  (wrong-import-order)\n'  # noqa: E501
         f'{notebook1}:cell_5:1:0: C0411: standard import "pprint" should be placed before first party import "nbqa"  (wrong-import-order)\n'  # noqa: E501
         f'{notebook1}:cell_5:2:0: C0411: standard import "sys" should be placed before first party import "nbqa"  (wrong-import-order)\n'  # noqa: E501
diff --git a/tests/tools/test_ruff_works.py b/tests/tools/test_ruff_works.py
index 4b44b07b..659dc287 100644
--- a/tests/tools/test_ruff_works.py
+++ b/tests/tools/test_ruff_works.py
@@ -53,9 +53,12 @@ def test_ruff_works(
     expected_path_2 = os.path.join("tests", "data", "notebook_starting_with_md.ipynb")
 
     out, err = capsys.readouterr()
+    # ignore ruff's suggestions
+    out = "\n".join([x for x in out.splitlines() if "cell_" in x])
     expected_out = (
-        "Found 13 errors.\n"
-        "[*] 10 fixable with the `--fix` option.\n"
+        f"{expected_path_1}:cell_1:1:8: F401 [*] `os` imported but unused\n"
+        f"{expected_path_1}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
+        f"{expected_path_1}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
         f"{expected_path_0}:cell_1:1:8: F401 [*] `os` imported but unused\n"
         f"{expected_path_0}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
         f"{expected_path_0}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
@@ -63,12 +66,9 @@ def test_ruff_works(
         f"{expected_path_0}:cell_4:1:20: F401 [*] `random.randint` imported but unused\n"
         f"{expected_path_0}:cell_5:1:1: E402 Module level import not at top of file\n"
         f"{expected_path_0}:cell_5:2:1: E402 Module level import not at top of file\n"
-        f"{expected_path_1}:cell_1:1:8: F401 [*] `os` imported but unused\n"
-        f"{expected_path_1}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
-        f"{expected_path_1}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
         f"{expected_path_2}:cell_1:1:8: F401 [*] `os` imported but unused\n"
         f"{expected_path_2}:cell_1:3:8: F401 [*] `glob` imported but unused\n"
-        f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused"
+        f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n"
     )
     assert "\n".join(sorted(out.replace("\r\n", "\n").splitlines())) == "\n".join(
         sorted(expected_out.splitlines())