refactor(tests): split test_dry_run.py into thematic modules (closes #604)#609
Merged
Conversation
…604) Split the monolithic 24 898-line test_dry_run.py (1 395 tests) into 15 focused modules by command type: - test_dry_run_shared.py — shared helpers (_dry_run, _read_dry_run, _rejected, _failing_run, _ids_csv, _write_jsonl) - test_dry_run_common.py — cross-cutting: generic get semantics, reports, micro-rubles validation, API error hints - test_dry_run_campaigns.py — campaigns add/update/get - test_dry_run_strategy_smart.py — SMART campaign bidding strategies - test_dry_run_strategy_text.py — TEXT campaign bidding strategies - test_dry_run_strategy_unified.py — UNIFIED campaign bidding strategies - test_dry_run_strategies.py — strategies service - test_dry_run_ads.py — ads, adimages, advideos, creatives - test_dry_run_adgroups.py — adgroups - test_dry_run_keywords.py — keywords, negativekeywordsharedsets - test_dry_run_bids.py — bids, keywordbids, bidmodifiers - test_dry_run_targets.py — audiencetargets, dynamicads, dynamicfeedadtargets, smartadtargets, retargeting - test_dry_run_extensions.py — sitelinks, vcards, adextensions, feeds - test_dry_run_clients.py — clients, agencyclients The original test_dry_run.py is now a 132‑line guard module that: 1. Preserves the historical rationale docstring. 2. Documents the new modular layout. 3. Runs a parametrized test that each split module imports and declares at least one test (test_dry_run_module_is_importable). Updated tests/test_api_coverage.py::test_dry_run_exclusion_focused_test_references_exist to scan all test_dry_run*.py files (not just test_dry_run.py) when validating DRY_RUN_PAYLOAD_EXCLUSIONS rationale references. Coverage: - Before: 2577 tests collected, 1395 in test_dry_run.py - After: 2591 tests collected (+14 new guard cases) - All 1 395 original test IDs preserved exactly (verified by diff) Flake8 status: same line-length violations as the original monolith (copied byte-for-byte; no new style issues introduced). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ruff complains about F401 in the three split modules that originally inherited the unused `from unittest.mock import patch` import from the monolith. The import is not used in these specific slices (it is used elsewhere in the original file). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes the last open task of issue #604 ("Update CLAUDE.md testing documentation"): add a bullet under ## Tests describing the modular split, and reword the strict-WSDL-parity exclusion clause so it points at the test_dry_run_*.py suite rather than the historical single file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
📋 Review summary — all cyclesReviewed locally (
Totals: 0 FIX, 0 SKIP, 0 UNVERIFIED. Both reviewers approved with no findings. Pre-review gap-fix (step 3): closed the last open task of issue #604 — documented the Coverage check: 1 395 original test node-IDs preserved exactly after the split; full offline suite 2521 passed (+14 new guard parametrization), CI green. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits the monolithic
tests/test_dry_run.py(24 898 lines, 1 395 tests) into 15 thematic modules by command type, as specified in issue #604.Changes
New modules (14 files)
test_dry_run_shared.py— shared helpers (_dry_run,_read_dry_run,_rejected,_failing_run,_ids_csv,_write_jsonl)test_dry_run_common.py— cross-cutting tests (genericgetsemantics, reports, micro-rubles validation, API error hints)test_dry_run_campaigns.py—campaigns add/update/gettest_dry_run_strategy_smart.py— SMART campaign bidding strategiestest_dry_run_strategy_text.py— TEXT campaign bidding strategiestest_dry_run_strategy_unified.py— UNIFIED campaign bidding strategiestest_dry_run_strategies.py—strategiesservicetest_dry_run_ads.py—ads,adimages,advideos,creativestest_dry_run_adgroups.py—adgroupstest_dry_run_keywords.py—keywords,negativekeywordsharedsetstest_dry_run_bids.py—bids,keywordbids,bidmodifierstest_dry_run_targets.py—audiencetargets,dynamicads,dynamicfeedadtargets,smartadtargets,retargetingtest_dry_run_extensions.py—sitelinks,vcards,adextensions,feedstest_dry_run_clients.py—clients,agencyclientsUpdated files (2 files)
tests/test_dry_run.py— now a 132‑line guard module with:test_dry_run_module_is_importableparametrized guard (14 cases)tests/test_api_coverage.py— updatedtest_dry_run_exclusion_focused_test_references_existto scan alltest_dry_run*.pyfilesVerification
Test coverage
test_dry_run*.pytestsThe +14 tests are the new
test_dry_run_module_is_importableguard cases (one per module). All 1 395 original test IDs are preserved exactly.Linting
black .— 1 reformatted file (test_dry_run_strategies.py), 14 unchangedflake8 tests/test_dry_run*.py— same line-length violations as the original monolith (copied byte-for-byte; no new style issues)Execution
test_read_cassettes.py)Benefits
Closes #604