Skip to content

fix: Add Flask middleware tests and fix signal handler - #139

Merged
TheRealAgentK merged 3 commits into
masterfrom
fix/add-flash-mw-tests
Jan 21, 2026
Merged

fix: Add Flask middleware tests and fix signal handler#139
TheRealAgentK merged 3 commits into
masterfrom
fix/add-flash-mw-tests

Conversation

@TheRealAgentK

Copy link
Copy Markdown
Contributor

Summary

Adds missing Flask middleware tests and fixes a bug in the signal handler.

Changes

Tests added (test_flask.py):

  • test_provider_registered_as_extension
  • test_attach_creates_sender
  • test_get_flask_environment
  • test_send_exception_calls_sender
  • test_send_exception_without_attach_logs_error
  • test_send_exception_merges_extra_environment_data
  • test_exception_signal_triggers_send
  • test_config_passed_to_sender

Bug fix (flask.py):

  • Fixed parameter conflict where Flask's got_request_exception signal passes exception as a kwarg, conflicting with send_exception(exception=...) signature
  • Added _handle_exception wrapper to properly receive signal kwargs

Testing

All 101 tests pass.

- Add test_flask.py with 8 tests covering Flask middleware
- Fix signal handler parameter conflict with Flask's got_request_exception signal
- Add _handle_exception wrapper to properly receive signal kwargs
@TheRealAgentK

Copy link
Copy Markdown
Contributor Author

Could you have a look at this please, @ProRedCat @miquelbeltran ?

The tests are fine, but I'm not 💯 about the additional bugfix to make some of the tests go.

@ProRedCat ProRedCat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks fine to me

@TheRealAgentK
TheRealAgentK marked this pull request as ready for review January 21, 2026 00:45
@TheRealAgentK
TheRealAgentK merged commit 778acc8 into master Jan 21, 2026
7 checks passed
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