Exemple #1
0
def main():
    args = parse_test_args()

    deno_dir = os.path.join(args.build_dir, ".deno_test")
    if os.path.isdir(deno_dir):
        rmtree(deno_dir)
    os.environ["DENO_DIR"] = deno_dir

    enable_ansi_colors()

    test_cases = [
        TestSetup,
        TestUtil,
        TestTarget,
        JsUnitTests,
        TestFetch,
        TestRepl,
        TestDenoDir,
        TestBenchmark,
        TestIsTty,
    ]
    test_cases += permission_prompt_tests()
    test_cases += complex_permissions_tests()
    # It is very slow, so do TestFmt at the end.
    test_cases += [TestFmt]

    with http_server.spawn():
        run_tests(test_cases)
import os
import shutil
import sys

import http_server
from test_util import DenoTestCase, run_tests
from util import mkdtemp, tests_path, run_output


class TestFetch(DenoTestCase):
    def test_fetch(self):
        deno_dir = mkdtemp()
        try:
            t = os.path.join(tests_path, "006_url_imports.ts")
            result = run_output([self.deno_exe, "fetch", t],
                                quiet=True,
                                merge_env={"DENO_DIR": deno_dir})
            self.assertEqual(result.out, "")
            self.assertEqual(result.code, 0)
            # Check that we actually did the prefetch.
            os.path.exists(
                os.path.join(
                    deno_dir,
                    "deps/http/localhost_PORT4545/cli/tests/subdir/mod2.ts"))
        finally:
            shutil.rmtree(deno_dir)


if __name__ == "__main__":
    run_tests()
                 None,
                 'Power [W],Elapsed time [h:mm:ss.hh],Heart rate [bpm]'
                ),
                (
                'Test a mandatory config is not set',
                'MissingConfigException',
                'mavg',
                None,
                10
                ),
                (
                'Test MAVG not in range',
                'MAVGOutOfRangeException',
                'mavg',
                1000,
                50
                ),
                (
                'Test invalid output/results',
                'TestUnexpectedResult',
                'results',
                [45,6,5],
                [23,1,12],
                )

                ]
            }


run_tests("./tests.xml")