Skip to content

Deduplicate FakeYoutubeDL test doubles into a shared stub factory#144

Merged
alexkroman merged 1 commit into
mainfrom
claude/test-smells-code-quality-99lpfi
Jun 13, 2026
Merged

Deduplicate FakeYoutubeDL test doubles into a shared stub factory#144
alexkroman merged 1 commit into
mainfrom
claude/test-smells-code-quality-99lpfi

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

test_youtube.py defined the yt-dlp context-manager scaffolding (init/
enter/exit/prepare_filename) ten separate times, with each test
varying only in what extract_info returns and what filename prepare_filename
reports. Collapse that into one _ydl_stub(monkeypatch, extract, filename=...)
factory that installs the fake and returns the captured opts/download dict,
plus a _raising_extract helper for the failure-path tests.

Net 110 fewer lines and each test now shows only the behavior it exercises.

https://claude.ai/code/session_017jJDCfDpkpjaWhCpo1Perk

test_youtube.py defined the yt-dlp context-manager scaffolding (__init__/
__enter__/__exit__/prepare_filename) ten separate times, with each test
varying only in what extract_info returns and what filename prepare_filename
reports. Collapse that into one _ydl_stub(monkeypatch, extract, filename=...)
factory that installs the fake and returns the captured opts/download dict,
plus a _raising_extract helper for the failure-path tests.

Net 110 fewer lines and each test now shows only the behavior it exercises.

https://claude.ai/code/session_017jJDCfDpkpjaWhCpo1Perk
@alexkroman alexkroman added this pull request to the merge queue Jun 13, 2026
Merged via the queue into main with commit faa8ce5 Jun 13, 2026
15 checks passed
@alexkroman alexkroman deleted the claude/test-smells-code-quality-99lpfi branch June 13, 2026 04:07
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