Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2268

Close clients created in test suite

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.11
    • Affects Version/s: None
    • Component/s: None
    • None

      MongoClients created in our test suite often go unclosed. We assume that they will eventually be garbage collected. However, the unittest module internally keeps TestCase instances alive so any clients attached to an instance will be kept alive. A quick investigation shows over 50 unclosed MongoClients handing around at the end of the test suite. These clients consume resources (threads, sockets, CPU time) and make the tests slower.

      We should close these clients and add an assertion at the end of the test suite to make sure all clients are closed.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: