-
Notifications
You must be signed in to change notification settings - Fork 421
tests: metrics tests fail when PYTHONWARNINGS="ignore"
#993
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
Comments
Changes: - run 'make format' - set 'warnings.simplefilter(default)' closes aws-powertools#993
@michaelbrewer could you provide more details about this issue before we merge? How did you run into it since this flag isn't set by default? Looking at the docs, it seems we should be doing this for all utilities not just metrics: https://docs.python.org/3/library/warnings.html#overriding-the-default-filter |
i was trying to disabled some setup issues with poetry on my m1 mac and it prints out warnings. |
@heitorlessa this is based on pythons recommended way for testing warnings: import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered.
warnings.simplefilter("always")
# Trigger a warning.
fxn()
# Verify some things
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "deprecated" in str(w[-1].message) |
What were you trying to accomplish?
Run
make test
whenPYTHONWARNINGS="ignore"
Expected Behavior
Test should pass
Current Behavior
Possible Solution
Temp set
warnings.simplefilter("default")
Steps to Reproduce (for bugs)
export PYTHONWARNINGS="ignore"
make test
Environment
The text was updated successfully, but these errors were encountered: