import os import sys from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parents[1])) from check_updates import check_service, load_dotenv, load_services, load_yaml @pytest.mark.skipif(os.getenv("RUN_LIVE_TESTS") != "1", reason="Live tests disabled") def test_live_service_versions(): load_dotenv() services = load_services(load_yaml("services.yaml")) failures = [] for service in services.values(): result = check_service(service, timeout=20, user_agent="service-update-alerts-test") if service.upstream_latest_version_url and not result["latest"]: failures.append(f"{service.name}: latest version missing ({result['latest_error']})") if service.current_version_url and not result["current"]: failures.append(f"{service.name}: current version missing ({result['current_error']})") if failures: pytest.fail("\n".join(failures))