The above-mentioned commit made sure that the root log level is not changed by the apply_config() method. This broke the logging-related test cases because they assume that they can change the root log level.
Changes made by this PR:
Add allow_overriding_root_log_level fixture that makes sure that the apply_config can change the root log level.
Simplify the InmantaLoggerConfig.clean_instance() method. In the previous implementation it made a call to logging.shutdown(), which closes all the handlers. This PR re-adds that method invocation to simplify the method. This is not an issue for pytest, because pytest re-adds their handlers after each test case.
Self Check:
[ ] Attached issue to pull request
[ ] Changelog entry
[x] Type annotations are present
[x] Code is clear and sufficiently documented
[x] No (preventable) type errors (check using make mypy or make mypy-diff)
[x] Sufficient test cases (reproduces the bug/tests the requested feature)
[x] Correct, in line with design
[ ] End user documentation is included or an issue is created for end-user documentation
[ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see test-fixes for more info)
Description
Same PR as https://github.com/inmanta/inmanta-core/pull/8153 but applied on the iso7 branch due to a merge conflict.
This PR fixes the logging-related test cases that broke due to https://github.com/inmanta/inmanta-core/commit/fc81b36711235eb10bf9aa0a4764b8422d42d34a.
Root cause of failures:
The above-mentioned commit made sure that the root log level is not changed by the
apply_config()
method. This broke the logging-related test cases because they assume that they can change the root log level.Changes made by this PR:
allow_overriding_root_log_level
fixture that makes sure that theapply_config
can change the root log level.InmantaLoggerConfig.clean_instance()
method. In the previous implementation it made a call tologging.shutdown()
, which closes all the handlers. This PR re-adds that method invocation to simplify the method. This is not an issue for pytest, because pytest re-adds their handlers after each test case.Self Check:
Attached issue to pull requestEnd user documentation is included or an issue is created for end-user documentationIf this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see test-fixes for more info)