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

PYTHON-4147-fix: Remove quote wrapping and remove shell=true usage #1513

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

Jibola
Copy link
Contributor

@Jibola Jibola commented Feb 7, 2024

Leveraged the shlex.split command to get my shell output as a proper list of args. It gave me: [sys.executable, "-c", '"from pymongo import MongoClient; c = MongoClient()"']
Tested Output on MacOS when commenting out RuntimeError catch:

test/test_monitor.py::TestMonitor::test_no_thread_start_runtime_err_on_shutdown FAILED                                                                                                                                                                                                                                                                                                 [100%]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

self = <test.test_monitor.TestMonitor testMethod=test_no_thread_start_runtime_err_on_shutdown>

    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(
            command, capture_output=True
        )
    
>       self.assertFalse(completed_process.stderr)
E       AssertionError: b'Exception in thread pymongo_server_monitor_thread:\nTraceback (most recent call last):\n  File "/opt/homebrew/Cellar/python@3.12/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1052, in _bootstrap_inner\n    self.run()\n  File "/opt/homebrew/Cellar/python@3.12/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 989, in run\n    self._target(*self._args, **self._kwargs)\n  File "/Users/jib/mongo/mongo-python-driver/pymongo/periodic_executor.py", line 141, in _run\n    if not self._target():\n           ^^^^^^^^^^^^^^\n  File "/Users/jib/mongo/mongo-python-driver/pymongo/monitor.py", line 62, in target\n    monitor._run()  # type:ignore[attr-defined]\n    ^^^^^^^^^^^^^^\n  File "/Users/jib/mongo/mongo-python-driver/pymongo/monitor.py", line 216, in _run\n    self._start_rtt_monitor()\n  File "/Users/jib/mongo/mongo-python-driver/pymongo/monitor.py", line 168, in _start_rtt_monitor\n    self._rtt_monitor.open()\n  File "/Users/jib/mongo/mongo-python-driver/pymongo/monitor.py", line 88, in open\n    self._executor.open()\n  File "/Users/jib/mongo/mongo-python-driver/pymongo/periodic_executor.py", line 98, in open\n    thread.start()\n  File "/opt/homebrew/Cellar/python@3.12/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 971, in start\n    _start_new_thread(self._bootstrap, ())\nRuntimeError: can\'t create new thread at interpreter shutdown\n' is not false

test/test_monitor.py:91: AssertionError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Evergreen Patch Run for Windows

@Jibola Jibola marked this pull request as ready for review February 7, 2024 16:11
@Jibola Jibola requested a review from a team as a code owner February 7, 2024 16:11
@Jibola Jibola requested review from caseyclements and ShaneHarvey and removed request for a team February 7, 2024 16:11
Copy link
Contributor

@caseyclements caseyclements left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eazy peazy

@Jibola Jibola merged commit fe37841 into mongodb:master Feb 7, 2024
71 of 75 checks passed
@Jibola Jibola deleted the PYTHON-4147-fix branch February 7, 2024 19:24
blink1073 pushed a commit to blink1073/mongo-python-driver that referenced this pull request Feb 20, 2024
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.

3 participants