Repository navigation
test: check the finalizer error inside FinalizerError, not its message - #42
Merged
Merged
Conversation
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.
Two tests fail against modern-di 4.1.0:
tests/test_aio.py::test_wrap_unary_aio_resets_context_var_when_close_raisestests/test_inject.py::test_wrap_unary_sync_resets_context_var_when_close_raisesBoth used
pytest.raises(RuntimeError, match="boom"). "boom" is the message of the finalizer's own exception, and on 4.0.0FinalizerError's message included it. In 4.1.0 (modern-python/modern-di#631) the message is a summary,Container.close_sync() found 1 finalizer error(s): RuntimeError (1), so the match fails. The integration code is unaffected.The tests now catch
FinalizerErrorand check that its only exception isRuntimeError("boom"). That checks the same thing without depending on the message text. They still go on to check that the context variable was reset, which is what they are for.Tests
modern-di>=4,<5range stays covered.just lintandjust test-ci(100% coverage) pass.