Skip to content

Commit

Permalink
test: ruff in tests for --stdin-filename
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Oct 21, 2024
1 parent d911d80 commit 7bf117a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/darker/tests/test_main_stdin_filename.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

# pylint: disable=too-many-arguments,use-dict-literal

from __future__ import annotations

from io import BytesIO
from typing import List, Optional
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch

import pytest
Expand All @@ -12,9 +14,11 @@
import darker.__main__
from darkgraylib.command_line import EXIT_CODE_CMDLINE_ERROR
from darkgraylib.config import ConfigurationError
from darkgraylib.testtools.git_repo_plugin import GitRepoFixture
from darkgraylib.testtools.helpers import raises_if_exception

if TYPE_CHECKING:
from darkgraylib.testtools.git_repo_plugin import GitRepoFixture

pytestmark = pytest.mark.usefixtures("find_project_root_cache_clear")


Expand Down Expand Up @@ -135,14 +139,16 @@
expect=0,
expect_a_py="original\n",
)
@pytest.mark.parametrize("formatter", [[], ["--formatter=black"], ["--formatter=ruff"]])
def test_main_stdin_filename(
git_repo: GitRepoFixture,
config_src: Optional[List[str]],
src: List[str],
stdin_filename: Optional[str],
revision: Optional[str],
config_src: list[str] | None,
src: list[str],
stdin_filename: str | None,
revision: str | None,
expect: int,
expect_a_py: str,
formatter: list[str],
) -> None:
"""Tests for `darker.__main__.main` and the ``--stdin-filename`` option"""
if config_src is not None:
Expand All @@ -165,7 +171,7 @@ def test_main_stdin_filename(
), raises_if_exception(expect):
# end of test setup

retval = darker.__main__.main(arguments)
retval = darker.__main__.main([*formatter, *arguments])

assert retval == expect
assert paths["a.py"].read_text() == expect_a_py
Expand Down

0 comments on commit 7bf117a

Please sign in to comment.