diff options
Diffstat (limited to 'tools/is_tty_test.py')
-rwxr-xr-x | tools/is_tty_test.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tools/is_tty_test.py b/tools/is_tty_test.py index 6f7509a8c..79267fdd5 100755 --- a/tools/is_tty_test.py +++ b/tools/is_tty_test.py @@ -1,27 +1,23 @@ #!/usr/bin/env python # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import os -import pty -import select import subprocess -from util import build_path, executable_suffix +import unittest from sys import stdin -from permission_prompt_test import tty_capture - -IS_TTY_TEST_TS = "tests/is_tty.ts" +from util import DenoTestCase, test_main, tty_capture -def is_tty_test(deno_exe): - cmd = [deno_exe, "run", IS_TTY_TEST_TS] - code, stdout, _ = tty_capture(cmd, b'') - assert code == 0 - assert str(stdin.isatty()).lower() in stdout +IS_TTY_TEST_TS = "tests/is_tty.ts" -def main(): - deno_exe = os.path.join(build_path(), "deno" + executable_suffix) - is_tty_test(deno_exe) +@unittest.skipIf(os.name == 'nt', "Unable to test tty on Windows") +class TestIsTty(DenoTestCase): + def test_is_tty(self): + cmd = [self.deno_exe, "run", IS_TTY_TEST_TS] + code, stdout, _ = tty_capture(cmd, b'') + assert code == 0 + assert str(stdin.isatty()).lower() in stdout if __name__ == "__main__": - main() + test_main() |