blob: 003fe4efc1a7a1c945ccf29d2a743ce76ac6bcc0 [file] [edit]
# Copyright 2026 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PRESUBMIT_VERSION = '2.0.0'
def _GetTestEnv(input_api):
"""Gets the common environment for running tests."""
test_env = dict(input_api.environ)
current_path = input_api.PresubmitLocalPath()
test_env.update({
'PYTHONPATH': current_path,
'PYTHONDONTWRITEBYTECODE': '1',
})
return test_env
def CheckScriptsUnittests(input_api, output_api):
"""Runs the unittests in the current directory."""
return input_api.canned_checks.RunUnitTestsInDirectory(
input_api,
output_api,
input_api.PresubmitLocalPath(),
[r'^.+_unittest\.py$'],
env=_GetTestEnv(input_api),
)