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

Close clients created in test suite

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.11
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: