summaryrefslogtreecommitdiff
path: root/tools/complex_permissions_test.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/complex_permissions_test.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/complex_permissions_test.py')
-rwxr-xr-xtools/complex_permissions_test.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/tools/complex_permissions_test.py b/tools/complex_permissions_test.py
index 40ba61819..00cda6069 100755
--- a/tools/complex_permissions_test.py
+++ b/tools/complex_permissions_test.py
@@ -2,13 +2,11 @@
# -*- coding: utf-8 -*-
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import os
-import subprocess
-import sys
-import time
import unittest
-from http_server import spawn
-from util import DenoTestCase, root_path, test_main, tty_capture
+import http_server
+from test_util import DenoTestCase, run_tests
+from util import root_path, tty_capture
PERMISSIONS_PROMPT_TEST_TS = "tools/complex_permissions_test.ts"
@@ -25,8 +23,8 @@ class BaseComplexPermissionTest(DenoTestCase):
return tty_capture(cmd, b'')
-class TestReadPermissions(BaseComplexPermissionTest):
- test_type = "read"
+class BaseReadWritePermissionsTest(object):
+ test_type = None
def test_inside_project_dir(self):
code, _stdout, stderr = self._run_deno(
@@ -97,7 +95,13 @@ class TestReadPermissions(BaseComplexPermissionTest):
os.chdir(saved_curdir)
-class TestWritePermissions(TestReadPermissions):
+class TestReadPermissions(BaseReadWritePermissionsTest,
+ BaseComplexPermissionTest):
+ test_type = "read"
+
+
+class TestWritePermissions(BaseReadWritePermissionsTest,
+ BaseComplexPermissionTest):
test_type = "write"
@@ -211,5 +215,5 @@ def complex_permissions_tests():
if __name__ == "__main__":
- with spawn():
- test_main()
+ with http_server.spawn():
+ run_tests()