Add test for TTY

This commit is contained in:
Nathan Trudeau
2026-05-04 13:38:35 -04:00
parent 6dca4aceb9
commit a866a498e7

View File

@@ -42,6 +42,16 @@ class UpdateEnvFileTests(unittest.TestCase):
class CollectUpdatesTests(unittest.TestCase):
def test_interactive_accepts_dev_tty_when_stdin_is_not_tty(self) -> None:
fake_tty = mock.mock_open()
with mock.patch.object(oe.sys.stdin, "isatty", return_value=False), mock.patch.object(
oe.sys.stderr,
"isatty",
return_value=True,
), mock.patch("builtins.open", fake_tty):
self.assertTrue(oe.interactive())
fake_tty.assert_called_once_with("/dev/tty", "r", encoding="utf-8")
def test_collects_password_github_and_pyarmor_when_missing(self) -> None:
env_values = {
oe.DEVPI_PASSWORD_KEY: "change-me",