From b8e40f50914ca756a42452d09dde242dbfd95483 Mon Sep 17 00:00:00 2001 From: karajan1001 Date: Mon, 17 Aug 2020 21:17:45 +0800 Subject: [PATCH] Solve check-ignore broken in a Linux pipeline (#4409) fix #4407 1. Update test, now it can simulate a pipeline situation. 2. Solve remove `isatty` check in `dvc check-ignore --stdin` command. --- dvc/command/check_ignore.py | 3 +-- tests/func/test_check_ignore.py | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/dvc/command/check_ignore.py b/dvc/command/check_ignore.py index 436004b84..61c55859b 100644 --- a/dvc/command/check_ignore.py +++ b/dvc/command/check_ignore.py @@ -4,7 +4,6 @@ import logging from dvc.command import completion from dvc.command.base import CmdBase, append_doc_link from dvc.exceptions import DvcException -from dvc.prompt import ask logger = logging.getLogger(__name__) @@ -39,7 +38,7 @@ class CmdCheckIgnore(CmdBase): ret = 1 while True: try: - target = ask("") + target = input() except (KeyboardInterrupt, EOFError): break if target == "": diff --git a/tests/func/test_check_ignore.py b/tests/func/test_check_ignore.py index 905b6245d..315d97251 100644 --- a/tests/func/test_check_ignore.py +++ b/tests/func/test_check_ignore.py @@ -130,8 +130,6 @@ def test_check_ignore_stdin_mode( ): tmp_dir.gen(DvcIgnore.DVCIGNORE_FILE, "ignored") mocker.patch("builtins.input", side_effect=[file, ""]) - stdout_mock = mocker.patch("sys.stdout") - stdout_mock.isatty.return_value = True assert main(["check-ignore", "--stdin"]) == ret assert (file in caplog.text) is output