You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Jupyter Server pytest plugin fixture, jp_serverapp, removes all handlers from the core application logger. This means that if you want to add/test custom log handlers to the application logger, you'll have to re-add these manually inside unit tests. This isn't great for end-to-end testing.
I think I originally cleared the handlers to avoid colliding with the stdout/stderr streams started by pytest. Pytest hijacks these stream and sometimes closes them before the server is done emitting logs, particularly in the case where kernels are still shutting down after a unit test.
Really, this is a symptom of a deeper issue. The _cleanup() method on the ServerApp calls cleanup on kernels and terminals. It calls run_sync is both cases, and returns a Future. This Future is never awaited, which when testing, introduces a race condition between the teardown of the unit test and the serverapp.
We can address the first issue, removing the logging handers, but rerouting the core application StreamHandler to something other than stderr/stdout.
The second issue likely needs some more discussion.
The text was updated successfully, but these errors were encountered:
The Jupyter Server pytest plugin fixture,
jp_serverapp
, removes all handlers from the core application logger. This means that if you want to add/test custom log handlers to the application logger, you'll have to re-add these manually inside unit tests. This isn't great for end-to-end testing.I think I originally cleared the handlers to avoid colliding with the stdout/stderr streams started by pytest. Pytest hijacks these stream and sometimes closes them before the server is done emitting logs, particularly in the case where kernels are still shutting down after a unit test.
Really, this is a symptom of a deeper issue. The
_cleanup()
method on the ServerApp calls cleanup on kernels and terminals. It callsrun_sync
is both cases, and returns aFuture
. ThisFuture
is never awaited, which when testing, introduces a race condition between the teardown of the unit test and the serverapp.We can address the first issue, removing the logging handers, but rerouting the core application
StreamHandler
to something other thanstderr
/stdout
.The second issue likely needs some more discussion.
The text was updated successfully, but these errors were encountered: