mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
8fb44eba5b
Move every test to a method on DenoTestCase. test.py is a single TestSuite of every TestCase. Add a Spawn context manager for http_server, this is explicitly used where it's needed. Each python test file can now be run independently without needing to manually run http_server. Add --help and consistent flags using argparse for each python test, including --failfast. Use ColorTextTestRunner so that '... ok' is green.
23 lines
604 B
Python
Executable file
23 lines
604 B
Python
Executable file
#!/usr/bin/env python
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
import os
|
|
import subprocess
|
|
import unittest
|
|
from sys import stdin
|
|
|
|
from util import DenoTestCase, test_main, tty_capture
|
|
|
|
IS_TTY_TEST_TS = "tests/is_tty.ts"
|
|
|
|
|
|
@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__":
|
|
test_main()
|