mirror of
https://github.com/denoland/deno.git
synced 2024-10-29 08:58:01 -04: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.
30 lines
896 B
Python
Executable file
30 lines
896 B
Python
Executable file
#!/usr/bin/env python
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
import os
|
|
import sys
|
|
import shutil
|
|
|
|
from http_server import spawn
|
|
from util import DenoTestCase, mkdtemp, tests_path, run_output, test_main
|
|
|
|
|
|
class FetchTest(DenoTestCase):
|
|
def test_fetch(self):
|
|
deno_dir = mkdtemp()
|
|
try:
|
|
t = os.path.join(tests_path, "006_url_imports.ts")
|
|
output = run_output([self.deno_exe, "fetch", t],
|
|
merge_env={"DENO_DIR": deno_dir})
|
|
assert output == ""
|
|
# Check that we actually did the prefetch.
|
|
os.path.exists(
|
|
os.path.join(
|
|
deno_dir,
|
|
"deps/http/localhost_PORT4545/tests/subdir/mod2.ts"))
|
|
finally:
|
|
shutil.rmtree(deno_dir)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
with spawn():
|
|
test_main()
|