diff --git a/src/darker/tests/test_linting.py b/src/darker/tests/test_linting.py index 4f7888db3..b0ce9f617 100644 --- a/src/darker/tests/test_linting.py +++ b/src/darker/tests/test_linting.py @@ -107,3 +107,15 @@ def test_run_linter(git_repo, monkeypatch, capsys, _descr, paths, location, expe # The test cases also verify that only linter reports on modified lines are output. result = capsys.readouterr().out.splitlines() assert result == [line.format(git_repo=git_repo) for line in expect] + + +def test_run_linter_non_worktree(): + """``run_linter()`` doesn't support linting commits, only the worktree""" + with pytest.raises(NotImplementedError): + + run_linter( + "dummy-linter", + Path("/dummy"), + {Path("dummy.py")}, + RevisionRange.parse("..HEAD"), + )