Skip to content

test: replace teardown_method with fixture for auth cleanup#691

Open
mvillmow wants to merge 2 commits into
mainfrom
521-auto-impl
Open

test: replace teardown_method with fixture for auth cleanup#691
mvillmow wants to merge 2 commits into
mainfrom
521-auto-impl

Conversation

@mvillmow

Copy link
Copy Markdown
Contributor

Summary

Use pytest fixtures with yield to ensure dead_letter_api_key is reset even if tests raise before teardown_method executes. Prevents singleton pollution and test interdependencies when assertions fail mid-setup.

Changes

  • Replaced teardown_method with autouse fixture in TestDeadLettersGetAuth class
  • Replaced teardown_method with autouse fixture in TestDeadLettersDeleteAuth class
  • Fixture uses try/finally to guarantee cleanup even on mid-setup assertion errors

Testing

  • All 379 existing tests pass with fixture-based cleanup
  • Fixture guarantees dead_letter_api_key reset even if _build_client raises

Closes

Closes #521

Generated by Claude Code via ProjectHephaestus automation.

@mvillmow mvillmow left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test-fixture fix is correct and complete, but PR commits coverage.xml (855-line build artifact leaking a local absolute path); remove and gitignore before merge.

Comment thread coverage.xml Outdated
Comment thread tests/test_webhook.py
mvillmow and others added 2 commits June 28, 2026 08:06
Use a pytest fixture with yield to ensure dead_letter_api_key is reset even if tests raise before teardown_method executes. Avoids singleton pollution and test interdependencies.

Closes #521

Implemented-By: claude-sonnet-4-6
Co-Authored-By: Claude Code <noreply@anthropic.com>
Signed-off-by: Claude Haiku 4.5 <4211002+mvillmow@users.noreply.github.com>
Generated coverage report should not be in version control (churns on every
test run, leaks absolute local paths). Addresses review feedback.

Signed-off-by: Claude Haiku 4.5 <4211002+mvillmow@users.noreply.github.com>
@mvillmow mvillmow enabled auto-merge (squash) June 28, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test teardown via teardown_method is fragile: reset dead_letter_api_key

1 participant