mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
The selector picked up two suites that can never pass in this stack, so editing either one turned the check permanently red: the presidio masking suite calls pytest.fail without an analyzer and anonymizer that up.sh never starts, and the pipecat audio suite skips itself at import time unless the NLTK punkt_tab data is present, which nothing installs. tests/e2e/coverage_registry/test_collector.py had the same problem for a different reason. Its nested pytest.main autoloads pytest-retry from the ci group the workflow installs and dies with "INTERNALERROR: no option named 'filtered_exceptions'", so the collect-only pass now disables that plugin. The plugin's entry point is pytest-retry, not retry, so the same one-word fix lands on mutmut's pytest_add_cli_args, where "-p no:retry" was disabling nothing. Two smaller holes in the harness: a canary argument the shell never expanded used to select nothing and let the gate pass green, and a secret that cannot be represented in both bash and dotenv was rejected without naming the key.
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
import re
|
|
import sys
|
|
from typing import Final
|
|
|
|
SELECTABLE: Final = re.compile(r"^tests/e2e/([A-Za-z0-9_.-]+/)*test_[A-Za-z0-9_.-]+\.py$")
|
|
UNSUPPORTED: Final = re.compile(
|
|
r"^tests/e2e/(ui|claude_code|load)/"
|
|
r"|^tests/e2e/llm_translation/realtime/test_realtime_pipecat_audio_e2e\.py$"
|
|
r"|^tests/e2e/batches/test_managed_files_enforcement_e2e\.py$"
|
|
r"|^tests/e2e/guardrails/test_presidio_masking_e2e\.py$"
|
|
)
|
|
HARNESS: Final = re.compile(
|
|
r"^tests/e2e/[A-Za-z0-9_.-]+\.(py|ini)$"
|
|
r"|^tests/e2e/gateway/"
|
|
r"|^\.github/e2e-stack/"
|
|
r"|^\.github/workflows/test-e2e-changed\.yml$"
|
|
)
|
|
UNEXPANDED: Final = re.compile(r"[*?\[]")
|
|
|
|
|
|
def is_selectable(path: str) -> bool:
|
|
return SELECTABLE.match(path) is not None and UNSUPPORTED.match(path) is None
|
|
|
|
|
|
def select(changed: tuple[str, ...], canary: tuple[str, ...]) -> tuple[str, ...]:
|
|
direct: Final = frozenset(path for path in changed if is_selectable(path))
|
|
harness_changed: Final = any(HARNESS.match(path) for path in changed)
|
|
canary_tests: Final = frozenset(path for path in canary if harness_changed and is_selectable(path))
|
|
return tuple(sorted(direct | canary_tests))
|
|
|
|
|
|
def main() -> int:
|
|
canary: Final = tuple(sys.argv[1:])
|
|
unexpanded: Final = tuple(path for path in canary if UNEXPANDED.search(path))
|
|
if unexpanded:
|
|
_ = sys.stderr.write(f"the canary paths reached the selector unexpanded: {' '.join(unexpanded)}\n")
|
|
return 1
|
|
changed: Final = tuple(line.strip() for line in sys.stdin if line.strip())
|
|
_ = sys.stdout.write(" ".join(select(changed, canary)) + "\n")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|