run_tests: move test filtering to pytest markers

Move the test disable logic even closer to the exact test that's
disabled.  This way people updating tests have a better chance of
seeing they'll get reduced coverage in the CQ.

Change-Id: I57c1a073a844019798b27e14d742fd32925d9ae8
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/462882
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger
2025-03-25 12:50:36 -04:00
committed by LUCI
parent d5087392ed
commit 8310436be0
4 changed files with 13 additions and 14 deletions

View File

@ -36,20 +36,7 @@ def is_ci() -> bool:
def run_pytest(argv: List[str]) -> int:
"""Returns the exit code from pytest."""
if is_ci():
# TODO(b/266734831): Find out why smoke tests fail.
# TODO(b/266734831): Find out why each superproject test takes 8m+.
tests_to_skip = (
"test_smoke_repo",
"test_smoke_git",
"test_superproject_get_superproject_invalid_branch",
"test_superproject_get_superproject_invalid_url",
)
print("WARNING: Skipping tests:", tests_to_skip)
argv = [
"-k",
" and ".join(f"not {x}" for x in tests_to_skip),
] + argv
argv = ["-m", "not skip_cq"] + argv
return pytest.main(argv)