-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-4147: Silence noisy thread.start() RuntimeError at shutdown #1486
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
Changes from 7 commits
52bb739
8e91c9e
ea7a37f
4eb0212
43b0fd2
c139c8b
deaf3ee
40a9fec
bfbbb4f
f6b3fcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
from __future__ import annotations | ||
|
||
import gc | ||
import subprocess | ||
import sys | ||
from functools import partial | ||
|
||
|
@@ -79,6 +80,17 @@ def test_cleanup_executors_on_client_close(self): | |
for executor in executors: | ||
wait_until(lambda: executor._stopped, f"closed executor: {executor._name}", timeout=5) | ||
|
||
def test_no_thread_start_runtime_err_on_shutdown(self): | ||
"""Test we silence noisy runtime errors fired when the MongoClient spawns a new thread | ||
on process shutdown.""" | ||
command = [sys.executable, "-c", "'from pymongo import MongoClient; c = MongoClient()'"] | ||
completed_process: subprocess.CompletedProcess = subprocess.run( | ||
" ".join(command), shell=True, capture_output=True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It needs to be a string with I'm not sure why this is the case and haven't found much good material explaining why, but since these tests are scoped and explicitly defined, I'd argue it's fine to keep this way. The only difference I know is that If anyone does know why it's not capturing the output in either stderr/stdout when using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see. Thanks for explaining. |
||
) | ||
|
||
self.assertFalse(completed_process.stderr) | ||
self.assertFalse(completed_process.stdout) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Uh oh!
There was an error while loading. Please reload this page.