-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch and verify an expected UserWarning
in the test suite
#8041
Catch and verify an expected UserWarning
in the test suite
#8041
Conversation
UserWarning
from one SQS FIFO queueUserWarning
in the test suite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kurtmckee! Thank you for improving our CI logs.
The tests are run twice - once regular, and once in ServerMode.
Moto in ServerMode runs in separate Docker-container, so we can't intercept any user warnings there.
We could handle this with an if-else (if normal: intercept warning & put_events, else: put_events without intercept). I'm not sure if it's worth the effort though, considering it doesn't improve the readability of the test.
If you can think of a different non-invasive way to achieve this, I'm all ears, but the warnings in the CI don't bother me enough to warrant big changes to the test.
Hello @bblommers, and thanks for the quick review! The benefit to reducing these warnings is to move toward escalating warnings to errors. It is possible to filter out warnings caused by project dependencies, but it's good hygiene to address (or filter out) existing warnings and then -- from a position of zero warnings -- escalate all warnings to errors. This allows CI to catch new Python It looks like the CI failures are unrelated to this change; were you mentioning the two modes of execution to suggest that this change caused some of the CI failures seen here? Here are the failing tests in CI (Python 3.12, Ubuntu):
but this PR only touched this test:
Looking at the Python 3.12 / Ubuntu CI logs, I'm not seeing that this is related, so please let me know if I'm misunderstanding what you're saying! |
@kurtmckee Those tests all reach out to website that was temporarily unavailable - that should be fine when restarting the build. I was talking about these logs:
|
Aha, I see now. Thanks for pointing that out! If you're game for it, lemme see if there's something simple that can be done for this scenario (it'll likely be Tuesday morning due to an upcoming holiday), otherwise you can close this PR. 👍 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8041 +/- ##
==========================================
+ Coverage 94.41% 94.49% +0.07%
==========================================
Files 1134 1150 +16
Lines 96832 99025 +2193
==========================================
+ Hits 91424 93571 +2147
- Misses 5408 5454 +46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you for fixing this @kurtmckee!
The test suite validates that an SQS FIFO queue with content-deduplication disabled does not receive messages from EventBridge, but doesn't catch and verify the
UserWarning
that gets raised in the code because of this (recent example in CI). As a result, thatUserWarning
gets reported by pytest at the end of the test run.This PR uses
pytest.warns()
to catch and verify the expectedUserWarning
.