Skip to content

Commit

Permalink
refactor,test: misc fixes for linters
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Aug 9, 2024
1 parent b9b4096 commit 3e002b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ ignore = [
"ANN201", # Missing return type annotation for public function
"ANN204", # Missing return type annotation for special method `__init__`
"C408", # Unnecessary `dict` call (rewrite as a literal)
"PLR0913", # Too many arguments in function definition (n > 5)
"S101", # Use of `assert` detected
]

Expand Down
3 changes: 3 additions & 0 deletions src/darker/tests/test_main_format_edited_parts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Tests for the `darker.__main__.format_edited_parts` function."""

# pylint: disable=too-many-arguments,use-dict-literal
# pylint: disable=use-implicit-booleaness-not-comparison

import logging
import re
from io import BytesIO
Expand Down
12 changes: 8 additions & 4 deletions src/darker/tests/test_main_isort.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Tests for the ``--isort`` option of the ``darker`` command-line interface"""

# pylint: disable=redefined-outer-name,unused-argument,use-dict-literal

from types import SimpleNamespace
from unittest.mock import patch

Expand All @@ -15,9 +17,11 @@
pytestmark = pytest.mark.usefixtures("find_project_root_cache_clear")


def test_isort_option_without_isort(git_repo, caplog):
"""Without isort, provide isort install instructions and error"""
with isort_present(False), patch.object(
def test_isort_option_without_isort(git_repo): # noqa: ARG001
"""Without isort, provide isort install instructions and error."""
# The `git_repo` fixture ensures test is not run in the Darker repository clone in
# CI builds. It helps avoid a NixOS test issue.
with isort_present(present=False), patch.object(
darker.__main__, "isort", None
), pytest.raises(MissingPackageError) as exc_info:

Expand All @@ -29,7 +33,7 @@ def test_isort_option_without_isort(git_repo, caplog):
)


@pytest.fixture
@pytest.fixture()
def run_isort(git_repo, monkeypatch, caplog, request):
"""Fixture for running Darker with requested arguments and a patched `isort`
Expand Down

0 comments on commit 3e002b4

Please sign in to comment.