aboutsummaryrefslogtreecommitdiffstats
path: root/python/wpt/test.py
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-06-24 11:15:27 +0200
committerMartin Robinson <mrobinson@igalia.com>2023-06-29 19:09:33 +0200
commitae9a9e1d17b57f6566db56a2e6f1cb9b9bec8d6a (patch)
tree57405e05887d599e9e8b3d4199578ff1b5a247c4 /python/wpt/test.py
parentedeed11cefba1524abbce55d398574c005b7687a (diff)
downloadservo-ae9a9e1d17b57f6566db56a2e6f1cb9b9bec8d6a.tar.gz
servo-ae9a9e1d17b57f6566db56a2e6f1cb9b9bec8d6a.zip
Combine all script tests into `test-scripts`
Remove: - tidy self test support from `./mach test` - `./mach test-idl` Adds a `./mach test-scripts` command that is responsible for running all Python script tests. Run this during the CI to catch regressions in changes to scripts. The WebIDL tests are still *very* slow and there are from Gecko, so only run them when "-a" is passed meaning all tests.
Diffstat (limited to 'python/wpt/test.py')
-rw-r--r--python/wpt/test.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/python/wpt/test.py b/python/wpt/test.py
index 4b8f0663676..f4744ae0030 100644
--- a/python/wpt/test.py
+++ b/python/wpt/test.py
@@ -26,30 +26,27 @@ import logging
import os
import shutil
import subprocess
-import sys
import tempfile
import threading
import time
import unittest
from functools import partial
-from typing import Any, Optional, Tuple
+from typing import Any, Optional, Tuple, Type
from wsgiref.simple_server import WSGIRequestHandler, make_server
import flask
import flask.cli
import requests
-from exporter import SyncRun, WPTSync
-from exporter.step import CreateOrUpdateBranchForPRStep
+
+from .exporter import SyncRun, WPTSync
+from .exporter.step import CreateOrUpdateBranchForPRStep
TESTS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tests")
SYNC: Optional[WPTSync] = None
TMP_DIR: Optional[str] = None
PORT = 9000
-if "-v" in sys.argv or "--verbose" in sys.argv:
- logging.getLogger().level = logging.DEBUG
-
@dataclasses.dataclass
class MockPullRequest():
@@ -666,8 +663,16 @@ def tearDownModule():
shutil.rmtree(TMP_DIR)
-if __name__ == "__main__":
- # Uncomment this line to enable verbose logging.
- # logging.getLogger().setLevel(logging.INFO)
+def run_tests():
+ verbosity = 1 if logging.getLogger().level >= logging.WARN else 2
+
+ def run_suite(test_case: Type[unittest.TestCase]):
+ return unittest.TextTestRunner(verbosity=verbosity).run(
+ unittest.TestLoader().loadTestsFromTestCase(test_case)
+ ).wasSuccessful()
- unittest.main()
+ return all([
+ run_suite(TestApplyCommitsToWPT),
+ run_suite(TestCleanUpBodyText),
+ run_suite(TestFullSyncRun),
+ ])