GoogleCloudPlatform / cloud-sql-python-connector

A Python library for connecting securely to your Cloud SQL instances.
Apache License 2.0
279 stars 65 forks source link

test: update tests to be more scalable #1156

Closed jackwotherspoon closed 3 weeks ago

jackwotherspoon commented 3 weeks ago

Current integration tests use a bad practice of initializing the Connector within the getconn creator func. This creates a Connector on each database conn instead of re-using a single connector:

def getconn() -> pg8000.dbapi.Connection:
    # initialize Connector object for connections to Cloud SQL
    with Connector() as connector:

This PR also makes a single test file be able to have tests connect to different Cloud SQL instances (wanted for CAS tests) by removing the pytest fixture in place of helper func.