summaryrefslogtreecommitdiff
path: root/tools/integration_tests.py
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-06-03 18:35:55 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-06-03 12:35:55 -0400
commit43c6c1a9f58a8d423a2d55092609e620f9765bcf (patch)
treef0bc5783b40bbde27dc52ff01552e21258e59324 /tools/integration_tests.py
parentbbc8de0c7a6a086ea7b0b79c6f5b005f9f374a7d (diff)
Refactor test infrastructure (#2432)
* 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
Diffstat (limited to 'tools/integration_tests.py')
-rwxr-xr-xtools/integration_tests.py43
1 files changed, 5 insertions, 38 deletions
diff --git a/tools/integration_tests.py b/tools/integration_tests.py
index 0f02ae2c5..6ce4f3d8b 100755
--- a/tools/integration_tests.py
+++ b/tools/integration_tests.py
@@ -7,16 +7,13 @@
# exit code can be specified.
#
# Usage: integration_tests.py [path to deno executable]
-import argparse
import os
import re
-import sys
import subprocess
-import unittest
-from http_server import spawn
-from util import (DenoTestCase, ColorTextTestRunner, root_path, tests_path,
- pattern_match, rmtree, test_main)
+import http_server
+from test_util import DenoTestCase, run_tests
+from util import root_path, tests_path, pattern_match, rmtree
def strip_ansi_codes(s):
@@ -107,36 +104,6 @@ for fn in sorted(
tn = t.__name__ = "test_" + fn.split(".")[0]
setattr(TestIntegrations, tn, t)
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument("--filter", help="Run specific tests")
- parser.add_argument(
- "--release", help="Use release build of Deno", action="store_true")
- parser.add_argument("--executable", help="Use external executable of Deno")
- args = parser.parse_args()
-
- target = "release" if args.release else "debug"
- build_dir = os.environ.get("DENO_BUILD_PATH",
- os.path.join(root_path, "target", target))
-
- deno_dir = os.path.join(build_dir, ".deno_test")
- if os.path.isdir(deno_dir):
- rmtree(deno_dir)
- os.environ["DENO_DIR"] = deno_dir
-
- test_names = [
- test_name for test_name in unittest.TestLoader().getTestCaseNames(
- TestIntegrations) if not args.filter or args.filter in test_name
- ]
- suite = unittest.TestLoader().loadTestsFromNames(
- test_names, module=TestIntegrations)
-
- with spawn():
- result = ColorTextTestRunner(verbosity=2).run(suite)
- if not result.wasSuccessful():
- sys.exit(1)
-
-
if __name__ == "__main__":
- main()
+ with http_server.spawn():
+ run_tests()