Skip to content

test: establish offline HTTP adapter contract - #253

Merged
Mattsface merged 2 commits into
release/0.8.0from
test/http-adapter-contract
Aug 1, 2026
Merged

test: establish offline HTTP adapter contract#253
Mattsface merged 2 commits into
release/0.8.0from
test/http-adapter-contract

Conversation

@Mattsface

@Mattsface Mattsface commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

Establishes deterministic offline characterization tests for MlbDataAdapter and MlbResult before the HTTP transport refactor in 0.8.0.

Mocked HTTP coverage moves out of tests/external_tests/. Live MLB API tests remain external-only. Known defects are locked in with strict xfail markers so a future fix surfaces as XPASS until the markers are removed.

Why

PR 1 of the 0.8.0 HTTP reliability release. Document current adapter behavior without changing production code.

What changed

  • Added tests/test_mlb_dataadapter.py (requests-mock characterization + 2 strict xfails)
  • Added tests/test_mlb_result.py (MlbResult constructor behavior + 2 strict xfails)
  • Trimmed tests/external_tests/mlbdataadapter/test_mlbadapter.py to live API tests only
  • Removed mocked test class and obsolete skipped live 500 test
  • Avoid requiring result.data is payload so a future copy-on-construct fix can preserve caller-owned data

What did not change

  • No production code changes (mlb_dataadapter.py, exceptions.py, __init__.py untouched)
  • No sessions, timeouts, retries, new exceptions, or public API changes
  • Current 404 / 500 / exception behavior preserved as documented

How tested

poetry run pytest tests/test_mlb_dataadapter.py tests/test_mlb_result.py -v
# 18 passed, 4 xfailed

poetry run pytest tests/ --ignore=tests/external_tests
# 87 passed, 4 xfailed

poetry run pytest tests/external_tests/mlbdataadapter/test_mlbadapter.py -v
# 3 passed

Risk

Low. Test-only change. Strict xfails intentionally fail the suite on XPASS after adapter-correctness fixes until markers are removed.

Intentionally left out

  • Adapter correctness fixes (fix/http-adapter-correctness)
  • Sessions, timeouts, retries, exception hierarchy changes
Open in Web Open in Cursor 

Separate mocked HTTP adapter characterization from live MLB API tests.
Add deterministic requests-mock coverage and strict xfail markers for
known defects that fix/http-adapter-correctness will address.

Co-authored-by: Matthew Spah <[email protected]>
@Mattsface
Mattsface marked this pull request as ready for review August 1, 2026 05:08
@Mattsface
Mattsface merged commit e6798d9 into release/0.8.0 Aug 1, 2026
3 checks passed
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