Skip to content
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

Make make_logging_logger() return log level to original state #1275

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

kard3n
Copy link
Contributor

@kard3n kard3n commented Jan 15, 2025

When tests use the make_logging_logger() context with the name set to None, the log level of the default/root logger is set but not reset after the context is terminated. This causes some tests in tests/test_coroutine_sink.py that make calls to the logger in an asynchronous context fail if they are executed after. This is caused by asyncio adding a log (specifically Using selector: EpollSelector) at DEBUG level when initialized, and due to the modified debug level this message is not discarded as expected.

For example, the following execution would fail: pytest tests/test_interception.py tests/test_coroutine_sink.py.

I fixed this by making make_logging_logger() remember the original log level, and restore it before exiting.

@Delgan Delgan merged commit 7455a07 into Delgan:master Jan 15, 2025
20 checks passed
@Delgan
Copy link
Owner

Delgan commented Jan 15, 2025

Well done. I wouldn't have guessed it. Thanks a lot for catching and investigating this problem!

@kard3n kard3n deleted the log_level_order_dependency branch January 15, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants