Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Nov 25, 2023
1 parent b0e5480 commit 27e0474
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions tests/test_hash_collision.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Check what happens if cell separator appears in notebook."""
import os

import pytest
from _pytest.capture import CaptureFixture
from _pytest.monkeypatch import MonkeyPatch

from nbqa.__main__ import main


@pytest.mark.skip(reason="too slow - TODO how to re-enable / speedup?")
def test_hash_collision(monkeypatch: MonkeyPatch, capsys: CaptureFixture) -> None:
"""Check hash collision error message."""
path = os.path.join("tests", "data", "notebook_for_testing.ipynb")
Expand Down
1 change: 1 addition & 0 deletions tests/test_runtime_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def test_unable_to_reconstruct_message_pythonpath(monkeypatch: "MonkeyPatch") ->
assert output.returncode == expected_returncode


@pytest.mark.skip(reason="too slow - TODO how to re-enable / speedup?")
def test_unable_to_parse(capsys: "CaptureFixture") -> None:
"""Check error message shows if we're unable to parse notebook."""
path = Path("tests") / "data/invalid_notebook.ipynb"
Expand Down
4 changes: 2 additions & 2 deletions tests/tools/test_pylint_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_pylint_works(capsys: "CaptureFixture") -> None:

expected_out = (
"************* Module tests.data.notebook_for_testing\n"
f"{notebook1}:cell_2:19:8: C0303: Trailing whitespace (trailing-whitespace)\n"
f"{notebook1}:cell_2:15:11: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)\n" # noqa: E501
f"{notebook1}:cell_2:19:8: C0303: Trailing whitespace (trailing-whitespace)\n" # noqa: E501
f"{notebook1}:cell_2:15:11: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)\n" # noqa: E501
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
Expand Down
12 changes: 6 additions & 6 deletions tests/tools/test_ruff_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ def test_ruff_works(

out, err = capsys.readouterr()
expected_out = (
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"
"Found 13 errors.\n"
"[*] 10 fixable with the `--fix` option.\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"
f"{expected_path_0}:cell_4:1:1: E402 Module level import not at top of file\n"
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\n"
"Found 13 errors.\n"
"[*] 10 potentially fixable with the --fix option.\n"
f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused"
)
assert "\n".join(sorted(out.replace("\r\n", "\n").splitlines())) == "\n".join(
sorted(expected_out.splitlines())
Expand Down

0 comments on commit 27e0474

Please sign in to comment.