test(compat): autouse fixture + cross-adapter dedup test for brand_manifest warning#690
Merged
bokelley merged 1 commit intoMay 12, 2026
Conversation
…nifest warning * Autouse fixture in tests/conftest.py clears the v2.5 ``_url._brand_manifest_path_warned`` set between every test, removing the per-test ``monkeypatch.setattr(...)`` boilerplate from the 10 existing warning tests. A future test that forgets the reset can no longer flake on inherited state. * New ``test_brand_manifest_dedup_is_cross_adapter`` asserts that the same offending URL through ``get_products`` and then ``create_media_buy`` warns exactly once per process — documents the shared-state semantic introduced in #687 and catches a regression back to per-module dedup. Fixes #689 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
Expert reviewcode-reviewer: approved — no blockers. Confirmed:
Nit (non-blocking): the autouse fixture lives at top-level CI: 15/15 green. Merging. |
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
Fixes #689. Test-hygiene follow-ups flagged on the #688 review.
tests/conftest.pyclearsadcp.compat.legacy.v2_5._url._brand_manifest_path_warnedbetween every test. The 10 existing warning tests drop theirmonkeypatch.setattr(...)boilerplate. A future test that forgets the reset can no longer flake on inherited state.test_brand_manifest_dedup_is_cross_adapterdocuments the shared-state semantic introduced in Extend brand_manifest non-standard-path warning to inline-object branch #687 — same offending URL throughget_productsthencreate_media_buywarns exactly once per process. Catches a regression back to per-module dedup.Verification
pytest tests/test_legacy_adapter_v2_5_*.py— 65 passed (was 64; +1 cross-adapter test, no net loss from the removed monkeypatch calls)._brand_manifest_path_warned.clear()between adapter calls): two warnings emitted, confirming the new test would catch that change.ruff check+mypyclean.Out of scope
Other nits flagged across this cluster but not addressed (intentional — small or theoretical):
_brand_manifest_path_warnedis an unboundedset). Per-deployment cardinality of distinctbrand_manifestURLs is small in practice; revisit if a real growth signal appears.strip_url_schemerename (now a bare-domain fallback forextract_brand_domain) — cosmetic.extract_brand_domain([::1]→"::1"failsBrandReference.domainregex without typed error) — theoretical forbrand_manifestURLs in practice.