-
Notifications
You must be signed in to change notification settings - Fork 192
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
Tests: Suppress logging and warnings from temporary profile fixture #5702
Tests: Suppress logging and warnings from temporary profile fixture #5702
Conversation
When the test suite is run without specifying a particular test profile, one is created on the fly using the `TemporaryProfileManager`. This would create a temporary configuration directory and a temporary profile which would generate a `UserWarning` and some `REPORT` level log messages. This info causes unnecessary noise and the warning even causes `pytest` to record that the tests issued a warning, but the warning is completely to be expected and benign, so here we capture the warnings and log messages.
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.
Thanks! The implementation looks all good.
I just wonder, does this also suppresses the warning of deprecation message from aiida-core itself or the dependent packages, which we may expect from the pytest
?
Not sure what you mean. This suppresses the warning and the logging no matter how this code is invoked. But in this case I think that is warranted, because these warnings and messages are not useful when setting up an automatic temporary profile. |
I mean if there is some part of the aiida-core code using old deprecated APIs, or the deprecated APIs of other dependent packages, the pytest will find it and report. This PR basically suppresses all warnings, so pytest can not be the source for those warnings. |
The messages being suppressed here are not deprecation warnings. There are two things being suppressed:
|
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.
Thanks for explanation @sphuber. It makes all sense. Cheers!
When the test suite is run without specifying a particular test profile, one is created on the fly using the
TemporaryProfileManager
. This would create a temporary configuration directory and a temporary profile which would generate aUserWarning
and someREPORT
level log messages.This info causes unnecessary noise and the warning even causes
pytest
to record that the tests issued a warning, but the warning is completely to be expected and benign, so here we capture the warnings and log messages.