|
@@ -32,22 +32,22 @@ TEST_TIMEOUT_S = 330 # 5m 30s
|
|
|
|
|
|
def DepotToolsPylint(input_api, output_api):
|
|
def DepotToolsPylint(input_api, output_api):
|
|
"""Gather all the pylint logic into one place to make it self-contained."""
|
|
"""Gather all the pylint logic into one place to make it self-contained."""
|
|
- white_list = [
|
|
|
|
|
|
+ files_to_check = [
|
|
r'^[^/]*\.py$',
|
|
r'^[^/]*\.py$',
|
|
r'^testing_support/[^/]*\.py$',
|
|
r'^testing_support/[^/]*\.py$',
|
|
r'^tests/[^/]*\.py$',
|
|
r'^tests/[^/]*\.py$',
|
|
r'^recipe_modules/.*\.py$', # Allow recursive search in recipe modules.
|
|
r'^recipe_modules/.*\.py$', # Allow recursive search in recipe modules.
|
|
]
|
|
]
|
|
- black_list = list(input_api.DEFAULT_BLACK_LIST)
|
|
|
|
|
|
+ files_to_skip = list(input_api.DEFAULT_BLOCK_LIST)
|
|
if os.path.exists('.gitignore'):
|
|
if os.path.exists('.gitignore'):
|
|
with open('.gitignore') as fh:
|
|
with open('.gitignore') as fh:
|
|
lines = [l.strip() for l in fh.readlines()]
|
|
lines = [l.strip() for l in fh.readlines()]
|
|
- black_list.extend([fnmatch.translate(l) for l in lines if
|
|
|
|
|
|
+ files_to_skip.extend([fnmatch.translate(l) for l in lines if
|
|
l and not l.startswith('#')])
|
|
l and not l.startswith('#')])
|
|
if os.path.exists('.git/info/exclude'):
|
|
if os.path.exists('.git/info/exclude'):
|
|
with open('.git/info/exclude') as fh:
|
|
with open('.git/info/exclude') as fh:
|
|
lines = [l.strip() for l in fh.readlines()]
|
|
lines = [l.strip() for l in fh.readlines()]
|
|
- black_list.extend([fnmatch.translate(l) for l in lines if
|
|
|
|
|
|
+ files_to_skip.extend([fnmatch.translate(l) for l in lines if
|
|
l and not l.startswith('#')])
|
|
l and not l.startswith('#')])
|
|
disabled_warnings = [
|
|
disabled_warnings = [
|
|
'R0401', # Cyclic import
|
|
'R0401', # Cyclic import
|
|
@@ -56,12 +56,12 @@ def DepotToolsPylint(input_api, output_api):
|
|
return input_api.canned_checks.GetPylint(
|
|
return input_api.canned_checks.GetPylint(
|
|
input_api,
|
|
input_api,
|
|
output_api,
|
|
output_api,
|
|
- white_list=white_list,
|
|
|
|
- black_list=black_list,
|
|
|
|
|
|
+ allow_list=files_to_check,
|
|
|
|
+ block_list=files_to_skip,
|
|
disabled_warnings=disabled_warnings)
|
|
disabled_warnings=disabled_warnings)
|
|
|
|
|
|
|
|
|
|
-def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3):
|
|
|
|
|
|
+def CommonChecks(input_api, output_api, tests_to_skip_list, run_on_python3):
|
|
input_api.SetTimeout(TEST_TIMEOUT_S)
|
|
input_api.SetTimeout(TEST_TIMEOUT_S)
|
|
|
|
|
|
results = []
|
|
results = []
|
|
@@ -72,10 +72,10 @@ def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3):
|
|
input_api, output_api))
|
|
input_api, output_api))
|
|
|
|
|
|
# Run only selected tests on Windows.
|
|
# Run only selected tests on Windows.
|
|
- tests_to_white_list = [r'.*test\.py$']
|
|
|
|
|
|
+ test_to_run_list = [r'.*test\.py$']
|
|
if input_api.platform.startswith(('cygwin', 'win32')):
|
|
if input_api.platform.startswith(('cygwin', 'win32')):
|
|
print('Warning: skipping most unit tests on Windows')
|
|
print('Warning: skipping most unit tests on Windows')
|
|
- tests_to_black_list = [
|
|
|
|
|
|
+ tests_to_skip_list = [
|
|
r'.*auth_test\.py$',
|
|
r'.*auth_test\.py$',
|
|
r'.*git_common_test\.py$',
|
|
r'.*git_common_test\.py$',
|
|
r'.*git_hyper_blame_test\.py$',
|
|
r'.*git_hyper_blame_test\.py$',
|
|
@@ -91,8 +91,8 @@ def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3):
|
|
input_api,
|
|
input_api,
|
|
output_api,
|
|
output_api,
|
|
'tests',
|
|
'tests',
|
|
- whitelist=tests_to_white_list,
|
|
|
|
- blacklist=tests_to_black_list,
|
|
|
|
|
|
+ allowlist=test_to_run_list,
|
|
|
|
+ blocklist=tests_to_skip_list,
|
|
run_on_python3=run_on_python3))
|
|
run_on_python3=run_on_python3))
|
|
|
|
|
|
# Validate CIPD manifests.
|
|
# Validate CIPD manifests.
|
|
@@ -131,14 +131,14 @@ def CommonChecks(input_api, output_api, tests_to_black_list, run_on_python3):
|
|
|
|
|
|
def CheckChangeOnUpload(input_api, output_api):
|
|
def CheckChangeOnUpload(input_api, output_api):
|
|
# Do not run integration tests on upload since they are way too slow.
|
|
# Do not run integration tests on upload since they are way too slow.
|
|
- tests_to_black_list = [
|
|
|
|
|
|
+ tests_to_skip_list = [
|
|
r'^checkout_test\.py$',
|
|
r'^checkout_test\.py$',
|
|
r'^cipd_bootstrap_test\.py$',
|
|
r'^cipd_bootstrap_test\.py$',
|
|
r'^gclient_smoketest\.py$',
|
|
r'^gclient_smoketest\.py$',
|
|
]
|
|
]
|
|
# TODO(ehmaldonado): Run Python 3 tests on upload once Python 3 is
|
|
# TODO(ehmaldonado): Run Python 3 tests on upload once Python 3 is
|
|
# bootstrapped on Linux and Mac.
|
|
# bootstrapped on Linux and Mac.
|
|
- return CommonChecks(input_api, output_api, tests_to_black_list, False)
|
|
|
|
|
|
+ return CommonChecks(input_api, output_api, tests_to_skip_list, False)
|
|
|
|
|
|
|
|
|
|
def CheckChangeOnCommit(input_api, output_api):
|
|
def CheckChangeOnCommit(input_api, output_api):
|