Skip to content

Commit 91cac7e

Browse files
committed
tests(util) Patch for isatty
1 parent c3e3fb0 commit 91cac7e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_util.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import sys
56
import typing as t
67

78
import pytest
@@ -35,8 +36,15 @@ def test_run_before_script_raise_BeforeLoadScriptError_if_retcode() -> None:
3536
run_before_script(script_file)
3637

3738

38-
def test_return_stdout_if_ok(capsys: pytest.CaptureFixture[str]) -> None:
39+
def test_return_stdout_if_ok(
40+
capsys: pytest.CaptureFixture[str],
41+
monkeypatch: pytest.MonkeyPatch,
42+
) -> None:
3943
"""run_before_script() returns stdout if script succeeds."""
44+
# Simulate sys.stdout.isatty() + sys.stderr.isatty()
45+
monkeypatch.setattr(sys.stdout, "isatty", lambda: True)
46+
monkeypatch.setattr(sys.stderr, "isatty", lambda: True)
47+
4048
script_file = FIXTURE_PATH / "script_complete.sh"
4149

4250
run_before_script(script_file)

0 commit comments

Comments
 (0)