Skip to content

Reuse QWeather response fixtures in tests - #14

Merged
IceCodeNew merged 1 commit into
masterfrom
codex/qweather-test-fixtures
Jul 14, 2026
Merged

Reuse QWeather response fixtures in tests#14
IceCodeNew merged 1 commit into
masterfrom
codex/qweather-test-fixtures

Conversation

@IceCodeNew

@IceCodeNew IceCodeNew commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • extract the repeated single-day QWeather forecast item into a shared test constant
  • add response helpers for standard weather and successful lifestyle-index payloads
  • reuse the helpers across QWeather error and air-quality parsing handlers while preserving each scenario's path, status, and malformed payload differences

Why

The affected tests repeated the same successful prerequisite responses, making their scenario-specific behavior harder to see and maintain.

Impact

This is a test-only refactor. Production behavior and test coverage are unchanged, while the QWeather handlers now emphasize only the response detail each test varies.

Stacking

This PR is based on fix/rss / #13 so it reflects the repository's current state. After #13 merges, rebase this branch onto master and retarget the PR.

Validation

  • .venv/bin/pytest tests/test_weather_context.py (35 passed)
  • .venv/bin/pytest --cov=weather_briefing --cov-branch (311 passed; 99.7066% total coverage)
  • .venv/bin/ruff check tests/test_weather_context.py
  • prek run --all-files
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@IceCodeNew, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f4636fc8-4d42-4dc3-bbad-043dcf59311d

📥 Commits

Reviewing files that changed from the base of the PR and between deaeae6 and 267637f.

📒 Files selected for processing (1)
  • tests/test_weather_context.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/qweather-test-fixtures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.26%. Comparing base (deaeae6) to head (267637f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #14      +/-   ##
==========================================
+ Coverage   99.21%   99.26%   +0.05%     
==========================================
  Files          34       34              
  Lines        4073     4079       +6     
  Branches      241      241              
==========================================
+ Hits         4041     4049       +8     
+ Misses         21       19       -2     
  Partials       11       11              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@IceCodeNew
IceCodeNew force-pushed the codex/qweather-test-fixtures branch from 69aa925 to bdd02d1 Compare July 14, 2026 03:25
@IceCodeNew
IceCodeNew force-pushed the codex/qweather-test-fixtures branch from bdd02d1 to 4a0a721 Compare July 14, 2026 03:28
@IceCodeNew
IceCodeNew force-pushed the codex/qweather-test-fixtures branch 2 times, most recently from 1c212b7 to 07a8a9d Compare July 14, 2026 04:01
@IceCodeNew
IceCodeNew force-pushed the codex/qweather-test-fixtures branch from 07a8a9d to 69ce8d4 Compare July 14, 2026 04:53
Base automatically changed from fix/rss to master July 14, 2026 05:13
@IceCodeNew
IceCodeNew force-pushed the codex/qweather-test-fixtures branch from 69ce8d4 to 267637f Compare July 14, 2026 05:14
@IceCodeNew
IceCodeNew marked this pull request as ready for review July 14, 2026 05:14
@IceCodeNew
IceCodeNew requested a review from Copilot July 14, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors tests/test_weather_context.py to reduce duplication in QWeather-related tests by extracting a shared “single-day forecast” fixture and adding small helper functions for common successful response payloads. This makes scenario-specific differences (status codes, malformed shapes, missing fields) more prominent without altering production behavior.

Changes:

  • Extract repeated QWeather 1-day forecast JSON into a shared _QWEATHER_DAILY_ITEM constant.
  • Add _qweather_weather_response(...) and _qweather_successful_indices_response() helpers to standardize common successful prerequisite responses.
  • Reuse helpers across multiple QWeather error/air-quality parsing tests while keeping each test’s unique failure condition intact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@IceCodeNew
IceCodeNew merged commit 236575f into master Jul 14, 2026
22 checks passed
@IceCodeNew
IceCodeNew deleted the codex/qweather-test-fixtures branch July 14, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants