This PR is pretty much just a rearranging of code, with no practical function changes. Files have been renamed to be less repetitive and more intuitive. There are few minor changes though: 1. `_boot.py` has been introduced to allow `alias/` sources to be able to include `tools/cr` into path and make themselves a submodule. This is not the best posssible solution, but it does avoid having to mess with PATH or PYTHONPATH and any other similar constant before calling these scripts. 2. `PRESUBMIT.py` has been updated to run tests in subdirectories.
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
# Copyright (c) 2025 The Brave Authors. All rights reserved.
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
"""Presubmit script for changes affecting tools/cr/
|
|
|
|
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
|
for more details about the presubmit API built into depot_tools.
|
|
"""
|
|
|
|
import os
|
|
|
|
PRESUBMIT_VERSION = '2.0.0'
|
|
|
|
|
|
def CheckTests(input_api, output_api):
|
|
script_dir = input_api.PresubmitLocalPath()
|
|
tests = []
|
|
for root, dirs, files in os.walk(script_dir):
|
|
dirs[:] = [d for d in dirs if d != '__pycache__']
|
|
if any(f.endswith('_test.py') for f in files):
|
|
tests.extend(
|
|
input_api.canned_checks.GetUnitTestsInDirectory(
|
|
input_api,
|
|
output_api,
|
|
root,
|
|
files_to_check=[r'.+_test\.py$']))
|
|
return input_api.RunTests(tests)
|