Auto merge of #29923 - mrobinson:test-scripts, r=jdm

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.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-06-30 00:18:58 +02:00 committed by GitHub
commit 57d34605e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 94 additions and 94 deletions

View file

@ -12,6 +12,8 @@ import sys
import mozlog.commandline
from . import test
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", ".."))
WPT_PATH = os.path.join(SERVO_ROOT, "tests", "wpt")
@ -62,3 +64,7 @@ def update_args_for_legacy_layout(kwargs: dict):
kwargs["include_manifest"] = os.path.join(
WPT_PATH, "include-legacy-layout.ini"
)
def run_tests():
return test.run_tests()

View file

@ -127,7 +127,7 @@ class SyncRun:
return SyncRun.clean_up_body_text(body) + f"\nReviewed in {self.servo_pr}"
@dataclasses.dataclass(kw_only=True)
@dataclasses.dataclass()
class WPTSync:
servo_repo: str
wpt_repo: str

View file

@ -1,4 +0,0 @@
-r requirements.txt
flask
types-requests

View file

@ -1 +0,0 @@
requests

View file

@ -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
unittest.main()
def run_suite(test_case: Type[unittest.TestCase]):
return unittest.TextTestRunner(verbosity=verbosity).run(
unittest.TestLoader().loadTestsFromTestCase(test_case)
).wasSuccessful()
return all([
run_suite(TestApplyCommitsToWPT),
run_suite(TestCleanUpBodyText),
run_suite(TestFullSyncRun),
])