diff options
author | Jonathan Metzman <metzman@chromium.org> | 2021-01-20 18:00:33 -0800 |
---|---|---|
committer | Jonathan Metzman <metzman@chromium.org> | 2021-01-20 18:00:33 -0800 |
commit | c5397ce3dff60eaf0397d6ff4dc90b6ee5038170 (patch) | |
tree | 794aeede85151f22408a56de09e4b890b7df0f84 /infra/presubmit.py | |
parent | e4195808a86d980278f2c85cc039666145edaf8e (diff) |
fix nits
Diffstat (limited to 'infra/presubmit.py')
-rwxr-xr-x | infra/presubmit.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/infra/presubmit.py b/infra/presubmit.py index f03f535f..9e3c8eaf 100755 --- a/infra/presubmit.py +++ b/infra/presubmit.py @@ -26,7 +26,7 @@ import yaml _SRC_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEST_BLOCKLIST = [ - # Test fails with error: `ModuleNotFoundError: No module named 'apt'`. + # Test errors with error: "ModuleNotFoundError: No module named 'apt'". re.compile(r'.*\/infra\/base-images\/base-sanitizer-libs-builder'), # TODO(https://github.com/google/oss-fuzz/issues/5025): Reenable these # tests. @@ -345,20 +345,17 @@ def is_test_dir_blocklisted(directory): def run_tests(_=None): """Run all unit tests.""" - changed_dirs = set() + relevant_dirs = set() all_files = get_all_files() for file_path in all_files: directory = os.path.dirname(file_path) if is_test_dir_blocklisted(directory): continue - changed_dirs.add(directory) + relevant_dirs.add(directory) - # TODO(metzman): This approach for running tests is flawed since tests can - # fail even if their directory isn't changed. Figure out if it is needed (to - # save time) and remove it if it isn't. suite_list = [] - for change_dir in changed_dirs: - suite_list.append(unittest.TestLoader().discover(change_dir, + for relevant_dir in relevant_dirs: + suite_list.append(unittest.TestLoader().discover(relevant_dir, pattern='*_test.py')) suite = unittest.TestSuite(suite_list) result = unittest.TextTestRunner().run(suite) |