Add tests for pull request test filtering
diff --git a/tools/run_tests/filter_pull_request_tests.py b/tools/run_tests/filter_pull_request_tests.py
index b7ebe20..981fbe3 100644
--- a/tools/run_tests/filter_pull_request_tests.py
+++ b/tools/run_tests/filter_pull_request_tests.py
@@ -31,7 +31,7 @@
"""Filter out tests based on file differences compared to merge target branch"""
import re
-from subprocess import call, check_output
+from subprocess import check_output
class TestSuite:
@@ -105,7 +105,7 @@
'config\.m4$': [_PHP_TEST_SUITE],
'CONTRIBUTING\.md$': [],
'Gemfile$': [_RUBY_TEST_SUITE],
- 'grpc.def$': [_WINDOWS_TEST_SUITE],
+ 'grpc\.def$': [_WINDOWS_TEST_SUITE],
'grpc\.gemspec$': [_RUBY_TEST_SUITE],
'gRPC\.podspec$': [_OBJC_TEST_SUITE],
'gRPC\-Core\.podspec$': [_OBJC_TEST_SUITE],
@@ -172,15 +172,11 @@
:param tests: list of all tests generated by run_tests_matrix.py
:return: list of relevant tests
"""
- print("Finding file differences between gRPC %s branch and pull request...\n" % base_branch)
+ print('Finding file differences between gRPC %s branch and pull request...\n' % base_branch)
changed_files = _get_changed_files(base_branch)
for changed_file in changed_files:
- print(" %s" % changed_file)
- print
-
- # todo(mattkwong): Remove this
- # Faking changed files to test test filtering on Jenkins
- changed_files = ['src/node/something', 'src/python/something']
+ print(' %s' % changed_file)
+ print('')
# Regex that combines all keys in _WHITELIST_DICT
all_triggers = "(" + ")|(".join(_WHITELIST_DICT.keys()) + ")"
@@ -193,8 +189,8 @@
for test_suite in _ALL_TEST_SUITES:
if _can_skip_tests(changed_files, test_suite.triggers):
for label in test_suite.labels:
- print(" %s tests safe to skip" % label)
+ print(' %s tests safe to skip' % label)
skippable_labels.append(label)
-
tests = _remove_irrelevant_tests(tests, skippable_labels)
return tests
+