1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-15 16:43:44 -05:00
denoland-deno/tools/is_tty_test.py

24 lines
607 B
Python
Raw Normal View History

2019-02-02 22:05:30 -05:00
#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import os
import unittest
2019-02-02 22:05:30 -05:00
from sys import stdin
from test_util import DenoTestCase, run_tests
from util import tty_capture
2019-02-11 12:57:26 -05:00
IS_TTY_TEST_TS = "tests/is_tty.ts"
2019-02-02 22:05:30 -05:00
2019-02-11 12:57:26 -05:00
@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
2019-02-02 22:05:30 -05:00
2019-02-11 12:57:26 -05:00
2019-02-02 22:05:30 -05:00
if __name__ == "__main__":
run_tests()