Google Flights MCP, CLI and Python Library
ci: run the offline search tests in CI and add a daily live canary (#246)
Punit Arani0bc1217e371d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex f23403e..61fc238 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -247,10 +247,7 @@ jobs:- name: Run testsrun: |- uv run pytest tests/ --all -v \- --ignore=tests/search/ \- -k "not test_search_dates_round_trip" \- --junitxml=junit.xml+ uv run pytest tests/ --all -v --junitxml=junit.xmlenv:FORCE_COLOR: 1diff --git a/.github/workflows/live-canary.yml b/.github/workflows/live-canary.ymlnew file mode 100644index 0000000..57d6582--- /dev/null+++ b/.github/workflows/live-canary.yml@@ -0,0 +1,211 @@+name: Live Canary++# Runs the SMALL, STABLE `live`-marked test set (all of+# test_search_flights_new_filters_live.py, the four live cases in+# tests/mcp/test_mcp_server.py::TestMCPServer, and the previously-unmocked+# cases in test_search_flights.py / test_search_dates.py — 29 tests total)+# against the real Google Flights network. These are excluded from the+# `--all` CI job (see ci.yml) because a transient search-page variant or a+# runner IP being treated worse than a residential one is a property of the+# network that day, not of this code — so they must not gate merges, but+# they must still run somewhere and be noisy when they break.+#+# Deliberately does NOT pass --all: that would also pull in the 100-case+# fuzz-gated live test (test_search_flights_fuzz.py), which is far flakier+# under a fast back-to-back burst (measured ~11% per-case failure rate) and+# would make this canary red almost every day. The fuzz-live case stays+# opt-in for humans only, via `make test-live-fuzz`; it is never scheduled.+#+# A canary's whole job is to be noisy when something is wrong, so it must+# not be able to die quietly: every pytest pass is bounded by `timeout`+# well under the job's own timeout-minutes, so a hung request becomes an+# ordinary non-zero exit instead of a job-level kill; the issue steps treat+# anything other than an explicit "success" output as failure-shaped (a+# setup step failing, a step crashing before it can report, etc. all count+# — see steps.live.outputs.result below); and they use `!cancelled()`+# rather than `always()` so a human cancelling a manual run doesn't file+# anything.++on:+ schedule:+ - cron: '17 6 * * *'+ workflow_dispatch:++permissions:+ contents: read+ issues: write++concurrency:+ group: live-canary+ cancel-in-progress: false++env:+ ISSUE_TITLE: "Live canary failing: Google Flights search"+ ISSUE_LABEL: "live-canary"++jobs:+ live-canary:+ name: Live search canary+ runs-on: ubuntu-latest+ # Comfortably above the worst case of the "Run live tests" step (two+ # 7-minute pytest passes + a 30s pause ≈ 14.5 min) plus setup/issue+ # overhead (~2-3 min) ≈ 17.5 min, so a hang inside a single pytest pass+ # is caught by that step's own `timeout` well before the job itself+ # would be killed.+ timeout-minutes: 25+ steps:+ - uses: actions/checkout@v7++ # Created up front (idempotently) so both the lookup and the create+ # step below can always rely on it existing — `gh issue create+ # --label` errors out if the label isn't already present in the repo.+ - name: Ensure canary issue label exists+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ REPO: ${{ github.repository }}+ LABEL: ${{ env.ISSUE_LABEL }}+ run: |+ set -euo pipefail+ gh label create "$LABEL" --repo "$REPO" --color ededed \+ --description "Opened/tracked by .github/workflows/live-canary.yml" 2>/dev/null || true++ - name: Install uv+ uses: astral-sh/setup-uv@v7+ with:+ version: "latest"++ - name: Set up Python+ run: uv python install 3.13++ - name: Install dependencies+ run: uv sync --extra dev --extra mcp++ - name: Run live tests (single retry of failures after a transient)+ id: live+ env:+ FORCE_COLOR: 1+ run: |+ set -euo pipefail+ set +e+ timeout 7m uv run pytest tests/ -m live --live -vv --junitxml=live-junit-1.xml+ first_status=$?+ set -e++ if [ "$first_status" -eq 0 ]; then+ echo "result=success" >> "$GITHUB_OUTPUT"+ exit 0+ fi++ echo "First run had failures or was killed after its 7-minute limit (exit" \+ "$first_status). Roughly 1 in 60 real requests hits a transient" \+ "search-page variant, so pausing 30s and re-running only the failed" \+ "cases once before raising the alarm."+ sleep 30++ set +e+ timeout 7m uv run pytest tests/ -m live --live --last-failed -vv --junitxml=live-junit-2.xml+ retry_status=$?+ set -e++ if [ "$retry_status" -eq 0 ]; then+ echo "Retry cleared every failure — treating this run as a pass."+ echo "result=success" >> "$GITHUB_OUTPUT"+ exit 0+ fi++ echo "::error::Live tests are still failing (or timing out) after one retry of the failed cases."+ echo "result=failure" >> "$GITHUB_OUTPUT"+ exit 1++ - name: Upload live test results+ if: always()+ uses: actions/upload-artifact@v7+ with:+ name: Live canary results+ path: live-junit-*.xml+ if-no-files-found: warn++ # Identifies the canary's own issue by exact title AND a dedicated+ # label (never just title) so this can never touch a user's issue. If+ # the lookup itself fails (transient GitHub API error), retry a+ # couple of times; if it still fails, fail this step loudly rather+ # than silently treating "lookup failed" as "no issue exists" — that+ # confusion is exactly what caused duplicate issues before this fix.+ # `!cancelled()` (not `always()`): a human cancelling a manual run+ # should not cause this — or the two issue-filing steps below — to+ # run at all.+ - name: Find existing canary issue+ if: "!cancelled()"+ id: find_issue+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ REPO: ${{ github.repository }}+ TITLE: ${{ env.ISSUE_TITLE }}+ LABEL: ${{ env.ISSUE_LABEL }}+ run: |+ set -euo pipefail+ attempt=1+ max_attempts=3+ until listing=$(gh issue list --repo "$REPO" --label "$LABEL" --state open --json number,title); do+ if [ "$attempt" -ge "$max_attempts" ]; then+ echo "::error::gh issue list failed after $max_attempts attempts;" \+ "not touching issues this run to avoid creating a duplicate."+ exit 1+ fi+ attempt=$((attempt + 1))+ sleep $((attempt * 5))+ done+ number=$(printf '%s' "$listing" | jq -r --arg t "$TITLE" '[.[] | select(.title == $t)][0].number // empty')+ echo "number=$number" >> "$GITHUB_OUTPUT"++ # Fires on anything other than an explicit "success" — not just an+ # explicit "failure" — so a step that never got to write its result+ # (job/step timeout, a crashed runner, uv sync failing before the+ # tests could even start) is treated as failure-shaped too, instead+ # of silently filing nothing. Only reachable when the lookup above+ # actually succeeded (never when it failed/was skipped), so a flaky+ # `gh issue list` cannot cause a duplicate issue to be created.+ - name: Open or update issue on failure+ if: "!cancelled() && steps.live.outputs.result != 'success' && steps.find_issue.outcome == 'success'"+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ REPO: ${{ github.repository }}+ TITLE: ${{ env.ISSUE_TITLE }}+ LABEL: ${{ env.ISSUE_LABEL }}+ RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}+ ISSUE_NUMBER: ${{ steps.find_issue.outputs.number }}+ LIVE_RESULT: ${{ steps.live.outputs.result }}+ LIVE_OUTCOME: ${{ steps.live.outcome }}+ run: |+ set -euo pipefail+ if [ "$LIVE_RESULT" = "failure" ]; then+ reason="the live tests failed twice in a row (initial run + one same-run retry of the failed cases)"+ elif [ "$LIVE_OUTCOME" = "skipped" ]; then+ reason="a setup step (installing uv, Python, or dependencies) failed before the live tests could start"+ else+ reason="the live-test step did not finish cleanly (it may have hit a time limit, crashed, or the runner was lost) before it could report a result"+ fi+ if [ -n "$ISSUE_NUMBER" ]; then+ gh issue comment "$ISSUE_NUMBER" --repo "$REPO" \+ --body "Live canary is still failing: ${reason}. Run: $RUN_URL"+ else+ gh issue create --repo "$REPO" \+ --title "$TITLE" \+ --label "$LABEL" \+ --body "The scheduled live-canary workflow failed: ${reason}. Run: $RUN_URL"+ fi++ - name: Close issue on recovery+ if: >-+ !cancelled() && steps.live.outputs.result == 'success' &&+ steps.find_issue.outcome == 'success' && steps.find_issue.outputs.number != ''+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ REPO: ${{ github.repository }}+ RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}+ ISSUE_NUMBER: ${{ steps.find_issue.outputs.number }}+ run: |+ set -euo pipefail+ gh issue comment "$ISSUE_NUMBER" --repo "$REPO" \+ --body "Live canary passed again. Run: $RUN_URL"+ gh issue close "$ISSUE_NUMBER" --repo "$REPO"diff --git a/AGENTS.md b/AGENTS.mdindex b0b4f26..86dc6bb 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -13,15 +13,30 @@ All standard commands are in the `Makefile` and `CLAUDE.md`. Key ones:- **Install deps**: `uv sync --all-extras`- **Lint**: `make lint` (ruff)- **Format**: `make format`-- **Tests**: `make test` (standard), `make test-all` (including fuzz)+- **Tests**: `make test` (standard, offline), `make test-all` (including fuzz, still offline), `make test-live` (small stable live set, real network), `make test-live-fuzz` (adds the noisier fuzz-gated live test, opt-in only)- **CLI**: `uv run fli flights JFK LAX 2026-05-15`- **MCP HTTP server**: `uv run fli-mcp-http` (serves at `http://127.0.0.1:8000/mcp/`)### Testing caveats-- Tests under `tests/search/` hit the live Google Flights API and are rate-limited (HTTP 429). These will frequently fail in cloud/CI environments. All other tests (CLI, core, models, MCP) are self-contained and pass reliably.-- Run `uv run pytest -vv --ignore=tests/search/` to skip flaky API-dependent tests.-- One MCP test (`test_search_dates_round_trip`) also makes a live API call and may fail with empty results.+- Almost all tests, including most of `tests/search/`, run entirely offline against captured+ fixtures/stubs — no network access is required and none of them are rate-limited.+- A small number of tests are marked `live` because they call the real Google Flights API:+ `test_search_flights_new_filters_live.py`, the parametrized case in+ `test_search_flights_fuzz.py`, the four search tests in+ `tests/mcp/test_mcp_server.py::TestMCPServer`, and a handful of previously-unmocked cases in+ `test_search_flights.py` / `test_search_dates.py`. These are skipped unless `--live` is passed+ (`--all` does **not** enable them), so `make test` / `make test-all` never hit the network.+ `--fuzz`, `--live` and `--all` are independent skip-only gates: a test needs *every* gate that+ applies to it passed together (the fuzz-gated live case needs both `--all`/`--fuzz` *and*+ `--live` at once — `-m live --live` alone silently drops it from collection).+ Run `make test-live` (`pytest -m live --live`, no `--all`) for the small, stable live set if you+ have network access — the same set that runs daily in `.github/workflows/live-canary.yml`,+ which retries one failed batch after a short pause before filing/updating a GitHub issue.+ `make test-live-fuzz` additionally runs the 100-case fuzz-gated live test, which is noticeably+ flakier under its back-to-back burst (~11% per-case failures measured) and is opt-in only —+ never scheduled. Any of these may skip on a transient transport failure but fail on an actual+ regression.### Releasingdiff --git a/CLAUDE.md b/CLAUDE.mdindex 79b6c2d..76fdbfa 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -20,9 +20,11 @@ Fli is a Python library that provides programmatic access to Google Flights datauv sync --all-extras# Run tests (use these specific commands)-make test # Standard test suite+make test # Standard test suite (offline only)make test-fuzz # Run fuzzing tests (pytest -vv --fuzz)-make test-all # Run all tests (pytest -vv --all)+make test-all # Run all offline tests, including fuzz (pytest -vv --all)+make test-live # Run the small, stable live tests (pytest -vv -m live --live)+make test-live-fuzz # Also run the flakier fuzz-gated live test (opt-in only)uv run pytest -vv # Alternative direct command# Code quality@@ -43,9 +45,32 @@ uv run mkdocs build # Build static docs```### Test Configuration-- Tests use pytest with custom markers: `fuzz` (requires `--fuzz` flag) and `parallel` (for pytest-xdist)+- Tests use pytest with custom markers: `fuzz` (requires `--fuzz` flag), `parallel` (for+ pytest-xdist), and `live` (requires `--live` flag). `--strict-markers` is set in `pytest.ini`,+ so a typo'd marker fails collection instead of silently running (or silently not being gated).- Test structure mirrors source code: `tests/cli/`, `tests/models/`, `tests/search/`, `tests/mcp/`- Fuzzing tests are available but gated behind `--fuzz` flag+- `live`-marked tests make real network calls to Google Flights (the fuzz case in+ `test_search_flights_fuzz.py`, all of `test_search_flights_new_filters_live.py`, the four+ search tests in `tests/mcp/test_mcp_server.py::TestMCPServer`, and a handful of+ historically-unmocked cases in `test_search_flights.py` / `test_search_dates.py`). They're+ skipped by default and **`--all` does not enable them** — `ci.yml` runs `pytest tests/ --all`,+ which stays fully offline so a flaky Google response never blocks a merge.+ - **How `--fuzz` / `--live` / `--all` interact**: each gate is independent and skip-only —+ `--all` enables `fuzz`-marked tests but deliberately does *not* enable `live`-marked ones (you+ always need `--live` for those), and `--live` alone does *not* enable `fuzz`-marked ones (a+ test marked both `fuzz` *and* `live`, i.e. the one case in `test_search_flights_fuzz.py`, needs+ **both** `--all` (or `--fuzz`) *and* `--live` together — `-m live --live` alone silently drops+ it from collection before the marker filter even runs).+ - `make test-live` (`pytest -m live --live`, no `--all`) runs the small, stable live set — the+ same set `.github/workflows/live-canary.yml` runs daily against the real network, which+ files/comments/closes a GitHub issue on failure/recovery instead of failing a build. It+ retries a single failure batch once (`--last-failed`) after a short pause before treating the+ run as failed, to absorb a lone transient page.+ - `make test-live-fuzz` (`pytest --all -m live --live tests/search/test_search_flights_fuzz.py`)+ additionally runs the 100-case fuzz-gated live test, which is opt-in for humans only — it+ measured ~11% per-case failures under a fast back-to-back burst in testing, well above the+ stable set's rate, so it is never scheduled.## Architecture Overviewdiff --git a/Makefile b/Makefileindex b5e1174..9051aba 100644--- a/Makefile+++ b/Makefile@@ -37,7 +37,7 @@ lint:lint-fix:uv run --extra dev ruff check --fix $(TARGETS)-# Run tests+# Run tests (offline only — live tests are excluded by default)test:uv run --extra dev pytest -vvtest-mcp:@@ -46,6 +46,17 @@ test-fuzz:uv run --extra dev pytest -vv --fuzztest-all:uv run --extra dev pytest -vv --all+# Run the small, stable 'live' tests against the real Google Flights network+# (matches .github/workflows/live-canary.yml, which runs this same set on a+# schedule; not part of CI). Deliberately omits --all/--fuzz, which would+# also pull in the far-flakier 100-case fuzz-live test below.+test-live:+ uv run --extra dev pytest -vv -m live --live+# Run the fuzz-gated live search case too (opt-in only — never scheduled,+# since it hits the real network ~100 times back-to-back and is noticeably+# flakier under that burst load than the stable live set above).+test-live-fuzz:+ uv run --extra dev pytest -vv --all -m live --live tests/search/test_search_flights_fuzz.py# Run CI locally using act (requires Docker and act: https://github.com/nektos/act)ci:@@ -102,10 +113,12 @@ help:@echo " make format - Format code using ruff"@echo " make lint - Lint code using ruff"@echo " make lint-fix - Lint and fix code using ruff"- @echo " make test - Run tests"+ @echo " make test - Run tests (offline only)"@echo " make test-mcp - Run tests with MCP"@echo " make test-fuzz - Run tests with fuzzing"@echo " make test-all - Run all tests"+ @echo " make test-live - Run the small, stable live tests (real network)"+ @echo " make test-live-fuzz - Run the fuzz-gated live test too (opt-in, noisier)"@echo " make ci - Run CI locally using act (requires Docker)"@echo " make ci-docker - Run CI in Docker container"@echo " make devcontainer - Build dev container image"@@ -113,4 +126,4 @@ help:@echo " make bump-preview - Preview next version (patch/minor/major)"@echo " make release-notes - Preview release notes since last tag"# Declare the targets as phony-.PHONY: help install install-dev install-all mcp mcp-http docs format lint lint-fix test test-mcp test-fuzz test-all ci ci-docker devcontainer requirements bump-preview release-notes+.PHONY: help install install-dev install-all mcp mcp-http docs format lint lint-fix test test-mcp test-fuzz test-all test-live test-live-fuzz ci ci-docker devcontainer requirements bump-preview release-notesdiff --git a/README.md b/README.mdindex 0f4a740..eda9a25 100644--- a/README.md+++ b/README.md@@ -545,7 +545,7 @@ cd fli# Install dependencies with uvuv sync --all-extras-# Run tests+# Run tests (offline only — no network access required)uv run pytest# Run linting@@ -557,11 +557,21 @@ uv run mkdocs serve# Or use the Makefile for common tasksmake install-all # Install all dependencies-make test # Run tests+make test # Run tests (offline only)+make test-live # Run the small, stable live tests (real network)make lint # Check code stylemake format # Format code```+Tests that call the real Google Flights API are marked `live` and skipped by+default (`--fuzz`, `--live` and `--all` are independent, skip-only gates —+`--all` does *not* imply `--live`, and `--live` alone does *not* imply+`--fuzz`). Run the small, stable live set with `make test-live` (or+`pytest -m live --live`); the noisier 100-case fuzz-gated live test is a+separate opt-in, `make test-live-fuzz` (`pytest --all -m live --live+tests/search/test_search_flights_fuzz.py` — it needs `--all`/`--fuzz`+*together with* `--live`, since it carries both markers).+### Docker Development```bashdiff --git a/pytest.ini b/pytest.iniindex d8c2c8a..8a8201e 100644--- a/pytest.ini+++ b/pytest.ini@@ -1,4 +1,6 @@[pytest]+addopts = --strict-markersmarkers =fuzz: mark test to run only with --fuzz flagparallel: mark test to run in parallel with pytest-xdist+ live: mark test as hitting the real Google Flights network; skipped unless --live is passeddiff --git a/tests/conftest.py b/tests/conftest.pyindex 02ea485..d43c662 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -43,15 +43,26 @@ def pytest_addoption(parser) -> None:parser.addoption("--fuzz", action="store_true", help="Run fuzz tests")parser.addoption("--mcp", action="store_true", help="Run MCP tests")parser.addoption("--all", action="store_true", help="Run all tests")+ parser.addoption(+ "--live",+ action="store_true",+ help="Run tests marked 'live' that hit the real Google Flights network",+ )def pytest_runtest_setup(item) -> None:- """Skip fuzz tests unless --fuzz or --all is specified."""+ """Skip fuzz tests unless --fuzz or --all is specified; skip live tests unless --live."""fuzz_marker = item.get_closest_marker("fuzz")if fuzz_marker is not None:if not item.config.getoption("--fuzz") and not item.config.getoption("--all"):pytest.skip("need --fuzz or --all option to run this test")+ # --all deliberately does NOT imply --live: CI runs with --all, and live+ # tests hit the real network (flaky by nature), so they must opt in+ # separately via --live. See the scheduled live-canary workflow.+ if item.get_closest_marker("live") is not None and not item.config.getoption("--live"):+ pytest.skip("need --live option to run this test (hits the real network)")+def pytest_collection_modifyitems(config, items) -> None:"""Modify collection based on custom flags."""diff --git a/tests/mcp/test_mcp_server.py b/tests/mcp/test_mcp_server.pyindex e9856c8..9ce3c92 100644--- a/tests/mcp/test_mcp_server.py+++ b/tests/mcp/test_mcp_server.py@@ -92,6 +92,7 @@ def assert_live_search(result: dict, *, results_key: str, trip_type: str) -> Nonclass TestMCPServer:"""Test suite for MCP server tools."""+ @pytest.mark.livedef test_search_flights_one_way(self):"""Test one-way flight search."""params = FlightSearchParams(@@ -107,6 +108,7 @@ class TestMCPServer:assert_live_search(result, results_key="flights", trip_type="ONE_WAY")+ @pytest.mark.livedef test_search_flights_round_trip(self):"""Test round-trip flight search."""params = FlightSearchParams(@@ -125,6 +127,7 @@ class TestMCPServer:assert_live_search(result, results_key="flights", trip_type="ROUND_TRIP")+ @pytest.mark.livedef test_search_dates_one_way(self):"""Test one-way date search."""start_date = (datetime.now() + timedelta(days=30)).strftime("%Y-%m-%d")@@ -147,6 +150,7 @@ class TestMCPServer:if result["success"]:assert "date_range" in result+ @pytest.mark.livedef test_search_dates_round_trip(self):"""Test round-trip date search."""start_date = (datetime.now() + timedelta(days=30)).strftime("%Y-%m-%d")diff --git a/tests/search/test_search_dates.py b/tests/search/test_search_dates.pyindex 4420bfc..276986d 100644--- a/tests/search/test_search_dates.py+++ b/tests/search/test_search_dates.py@@ -181,6 +181,9 @@ INFANT_RESULTS_MISSING = pytest.mark.xfail()+# The `search` fixture above is a bare SearchDates() with no HTTP mocking,+# so every test below that uses it hits the real Google Flights network.@pytest.mark.parametrize("search_params_fixture",[@@ -195,6 +198,7 @@ def test_search_functionality(search, search_params_fixture, request):assert isinstance(results, list)@INFANT_RESULTS_MISSINGdef test_multiple_searches(search, basic_search_params, complex_search_params):"""Test performing multiple searches with the same SearchDates instance."""@@ -211,6 +215,7 @@ def test_multiple_searches(search, basic_search_params, complex_search_params):assert isinstance(results3, list)def test_date_price_sorting(search, basic_search_params):"""Test that date prices are sorted chronologically."""results = search.search(basic_search_params)@@ -239,6 +244,7 @@ def test_parse_price_from_calendar_item():assert SearchDates._SearchDates__parse_price(CALENDAR_ITEM) == 118.0def test_basic_round_trip_search(search, round_trip_search_params):"""Test basic round trip date search functionality."""results = search.search(round_trip_search_params)@@ -258,6 +264,7 @@ def test_basic_round_trip_search(search, round_trip_search_params):assert result.price > 0def test_complex_round_trip_search(search, complex_round_trip_params):"""Test complex round trip date search with multiple passengers and stops."""results = search.search(complex_round_trip_params)@@ -277,6 +284,7 @@ def test_complex_round_trip_search(search, complex_round_trip_params):assert result.price > 0@pytest.mark.parametrize("search_params_fixture",[@@ -346,8 +354,23 @@ class TestRoundTripDurationFallback:assert results and all(len(r.date) == 2 for r in results)# Outbound and return are 7 days apart in the fixture's segments.assert all((r.date[1] - r.date[0]).days == 7 for r in results)- tfs = urls[0].split("tfs=")[1].split("&")[0]- decoded = base64.urlsafe_b64decode(tfs + "=" * (-len(tfs) % 4)).decode("latin-1")++ # The date sweep prices every candidate date on the shared thread+ # pool (see fli/search/_concurrency.py), so `urls` fills in whatever+ # order the fetches happen to complete in — NOT the order `results`+ # ends up in (which is sorted after the fact). `urls[0]` is+ # therefore not guaranteed to be the request that produced+ # `results[0]`; decode every recorded URL and look up the one whose+ # `tfs` token actually encodes the result under test instead.+ def _decode_tfs(url: str) -> str:+ tfs = url.split("tfs=")[1].split("&")[0]+ return base64.urlsafe_b64decode(tfs + "=" * (-len(tfs) % 4)).decode("latin-1")++ decoded_urls = [_decode_tfs(u) for u in urls]for r in results[:1]:- assert r.date[0].strftime("%Y-%m-%d") in decoded- assert r.date[1].strftime("%Y-%m-%d") in decoded+ outbound_str = r.date[0].strftime("%Y-%m-%d")+ return_str = r.date[1].strftime("%Y-%m-%d")+ assert any(outbound_str in d and return_str in d for d in decoded_urls), (+ f"no fetched URL encoded both {outbound_str} and {return_str} "+ f"(checked {len(decoded_urls)} URLs)"+ )diff --git a/tests/search/test_search_flights.py b/tests/search/test_search_flights.pyindex 917fc59..2ed75df 100644--- a/tests/search/test_search_flights.py+++ b/tests/search/test_search_flights.py@@ -187,6 +187,9 @@ INFANT_RESULTS_MISSING = pytest.mark.xfail()+# The `search` fixture above is a bare SearchFlights() with no HTTP mocking,+# so both tests below hit the real Google Flights network.@pytest.mark.parametrize("search_params_fixture",[@@ -201,6 +204,7 @@ def test_search_functionality(search, search_params_fixture, request):assert isinstance(results, list)@INFANT_RESULTS_MISSINGdef test_multiple_searches(search, basic_search_params, complex_search_params):"""Test performing multiple searches with the same Search instance."""diff --git a/tests/search/test_search_flights_fuzz.py b/tests/search/test_search_flights_fuzz.pyindex b37debb..0690e8e 100644--- a/tests/search/test_search_flights_fuzz.py+++ b/tests/search/test_search_flights_fuzz.py@@ -1,4 +1,10 @@-"""Fuzz testing for Search functionality."""+"""Fuzz testing for Search functionality.++``test_search_fuzz`` below calls ``SearchFlights.search`` with no mocking, so+each of its parametrized cases hits the real Google Flights network. It is+marked both ``fuzz`` (needs --fuzz/--all) and ``live`` (needs --live) so a+plain ``--all`` run never dials out.+"""import randomfrom datetime import datetime, timedelta@@ -89,6 +95,7 @@ def generate_random_test_cases(num_tests: int) -> list[tuple]:@pytest.mark.fuzz@pytest.mark.parallel@pytest.mark.parametrize("dep_airport, arr_airport, dep_date, adults, children, infants_on_lap, infants_in_seat, seat_type, stops, sort_by", # noqa: E501diff --git a/tests/search/test_search_flights_new_filters_live.py b/tests/search/test_search_flights_new_filters_live.pyindex 1086e00..e4379af 100644--- a/tests/search/test_search_flights_new_filters_live.py+++ b/tests/search/test_search_flights_new_filters_live.py@@ -28,6 +28,8 @@ from fli.models import ()from fli.search import SearchFlights+pytestmark = pytest.mark.live+def _future(days: int) -> str:return (datetime.now() + timedelta(days=days)).strftime("%Y-%m-%d")