Repository navigation
Description
Parent: #297
Goal
Replace the remaining unittest.TestCase-based external (live) test suites with the lighter, plain-pytest smoke-test style established by #318 (tests/external_tests/mlb/test_mlb_smoke.py and tests/external_tests/async_mlb/test_async_mlb_smoke.py).
Background
Most of tests/external_tests/ still uses an older pattern: a unittest.TestCase per resource with a setUpClass that hits the live MLB API once, followed by a long list of assertTrue(hasattr(...)) checks for every model field. This duplicates coverage that already exists offline (Pydantic validation, tests/parsers/, tests/models/), is more brittle to upstream field changes, and is heavier to maintain than the newer smoke tests, which just confirm connectivity and that the response parses into the right type.
Scope
Files currently using the unittest.TestCase pattern that should move to the smoke-test style:
tests/external_tests/attendance/test_attendance.pytests/external_tests/awards/test_awards.pytests/external_tests/division/test_division.pytests/external_tests/drafts/test_draft.pytests/external_tests/game/test_game.pytests/external_tests/gamepace/test_gamepace.pytests/external_tests/homerunderby/test_homerunderby.pytests/external_tests/league/test_league.pytests/external_tests/mlb/test_mlb.pytests/external_tests/mlbdataadapter/test_mlbadapter.pytests/external_tests/person/test_person.pytests/external_tests/schedule/test_schedule.pytests/external_tests/seasons/test_seasons.pytests/external_tests/sport/test_sport.pytests/external_tests/standings/test_standings.pytests/external_tests/stats/test_catching.pytests/external_tests/stats/test_fielding.pytests/external_tests/stats/test_hitting.pytests/external_tests/stats/test_pitching.pytests/external_tests/stats/test_player_game_stats.pytests/external_tests/team/test_roster.pytests/external_tests/team/test_team.pytests/external_tests/venue/test_venue.py
For each file:
- Replace the
unittest.TestCaseclass with plain pytest functions, one per endpoint call, matching the shape oftest_mlb_smoke.py/test_async_mlb_smoke.py: call the endpoint, assert the return type, and assert one or two representative fields. - Drop the per-field
hasattrassertions; field-level shape is already the offline suite's job. - Keep the live IDs/fixtures already in use (e.g. team 133, sport 1, league 103, division 200) so the smoke tests keep exercising the same real resources.
test_mlb.pyandtest_mlbadapter.pyare grab-bag files covering multiple concerns; split their smoke-worthy assertions out per endpoint/resource rather than porting the file as one block.
Constraints
- These suites only run against the live MLB API (
.github/workflows/external-tests.yml, weekly + manual dispatch) and must keep not running as part of the default offlinepytest tests/suite. - Do not remove live coverage of any endpoint currently exercised; this is a style refactor, not a coverage reduction.
- Before deleting a
hasattr/ValidationError-style assertion, confirm the same field or required-field behavior is already covered by an offline test (tests/parsers/,tests/models/, or similar); file a note here if a gap is found rather than silently dropping coverage.
Acceptance criteria
- Every file listed above uses the plain-pytest smoke style instead of
unittest.TestCase - No live-endpoint coverage is lost relative to today
-
tests/external_tests/still only runs via the external-tests workflow, not the default suite - Any coverage gap discovered during the port is called out explicitly, not silently dropped
Refs #297
Activity
feat(async): add get_season/get_seasons to AsyncMlb