diff --git a/src/darker/tests/test_main.py b/src/darker/tests/test_main.py index 19f1fa928..f2070740c 100644 --- a/src/darker/tests/test_main.py +++ b/src/darker/tests/test_main.py @@ -946,15 +946,18 @@ def test_stdout_path_resolution(git_repo, capsys): @pytest.mark.parametrize("newline", ["\n", "\r\n"], ids=["unix", "windows"]) -def test_stdout_newlines(tmp_path, monkeypatch, capsysbinary, newline): +def test_stdout_newlines(git_repo, monkeypatch, capsysbinary, newline): """When using ``--stdout``, newlines are not duplicated. See: https://github.com/akaihola/darker/issues/604 + The `git_repo` fixture is used to ensure that the test doesn't run in the Darker + repository clone in CI. It helps avoid the Git error message + "fatal: Not a valid object name origin/master" in the NixOS CI tests. + """ if WINDOWS and sys.version_info < (3, 10): # See https://bugs.python.org/issue38671 - monkeypatch.chdir(tmp_path) Path("new-file.py").touch() code = f"import collections{newline}import sys{newline}".encode() with patch("sys.stdin.buffer.read", return_value=code): @@ -968,15 +971,18 @@ def test_stdout_newlines(tmp_path, monkeypatch, capsysbinary, newline): @pytest.mark.parametrize("newline", ["\n", "\r\n"], ids=["unix", "windows"]) -def test_stdout_newlines_subprocess(tmp_path, monkeypatch, newline): +def test_stdout_newlines_subprocess(git_repo, monkeypatch, newline): """When using ``--stdout``, newlines are not duplicated. See: https://github.com/akaihola/darker/issues/604 + The `git_repo` fixture is used to ensure that the test doesn't run in the Darker + repository clone in CI. It helps avoid the Git error message + "fatal: Not a valid object name origin/master" in the NixOS CI tests. + """ if WINDOWS and sys.version_info < (3, 10): # See https://bugs.python.org/issue38671 - monkeypatch.chdir(tmp_path) Path("new-file.py").touch() code = f"import collections{newline}import sys{newline}".encode() try: