mirror of
https://github.com/denoland/deno.git
synced 2024-10-31 09:14:20 -04:00
43c6c1a9f5
* use subclass of unittest.TestCase for all test cases * allow to run single test file (eg. python tools/integration_tests.py) * test filtering (via --pattern/-p CLI flag) * use common CLI parser for all tests: usage: test.py [-h] [--failfast] [--verbose] [--executable EXECUTABLE] [--release] [--pattern PATTERN] [--build-dir BUILD_DIR] optional arguments: -h, --help show this help message and exit --failfast, -f Stop on first failure --verbose, -v Verbose output --executable EXECUTABLE Use external executable of Deno --release Test against release executable --pattern PATTERN, -p PATTERN Run tests that match provided pattern --build-dir BUILD_DIR Deno build directory * respect NO_COLOR variable
30 lines
907 B
Python
Executable file
30 lines
907 B
Python
Executable file
#!/usr/bin/env python
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
import os
|
|
import shutil
|
|
|
|
import http_server
|
|
from test_util import DenoTestCase, run_tests
|
|
from util import mkdtemp, tests_path, run_output
|
|
|
|
|
|
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 http_server.spawn():
|
|
run_tests()
|