Skip to content

Commit

Permalink
Run import sorting tests in a temporary Git repo
Browse files Browse the repository at this point in the history
This fixes test failures when running tests from a cwd which isn't in a
Git repository.
  • Loading branch information
akaihola committed Apr 13, 2024
1 parent e751ed6 commit 6a2d386
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/darker/tests/test_import_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from darker.git import EditedLinenumsDiffer
from darker.tests.helpers import isort_present
from darkgraylib.git import RevisionRange
from darkgraylib.testtools.git_repo_plugin import GitRepoFixture
from darkgraylib.utils import TextDocument, joinlines

ORIGINAL_SOURCE = ("import sys", "import os", "", "print(42)")
Expand Down Expand Up @@ -171,7 +172,7 @@ def test_isort_config(monkeypatch, tmpdir, line_length, settings_file, expect):
config=None,
line_length=None,
)
def test_build_isort_args(src, config, line_length, expect):
def test_build_isort_args(git_repo: GitRepoFixture, src, config, line_length, expect):

Check failure on line 175 in src/darker/tests/test_import_sorting.py

View workflow job for this annotation

GitHub Actions / Mypy

src/darker/tests/test_import_sorting.py#L175

Function is missing a return type annotation [no-untyped-def]

Check failure on line 175 in src/darker/tests/test_import_sorting.py

View workflow job for this annotation

GitHub Actions / Mypy

src/darker/tests/test_import_sorting.py#L175

Function is missing a type annotation for one or more arguments [no-untyped-def]
"""``_build_isort_args`` returns correct arguments for isort"""
result = darker.import_sorting._build_isort_args(src, config, line_length)

Expand Down

0 comments on commit 6a2d386

Please sign in to comment.