TerekhovaKate commented on code in PR #7583: URL: https://github.com/apache/trafficcontrol/pull/7583#discussion_r1235606317
########## traffic_ops/testing/api_contract/v4/conftest.py: ########## @@ -311,6 +312,23 @@ def to_login(to_args: ArgsType) -> TOSession: return to_session +@pytest.fixture(scope="session", name="db_connection") +def open_db_connection(): + """ + Creates new traffic ops db connection. + :returns: New Traffic ops database connection + """ + conn = psycopg2.connect( + user="traffic_ops", + password="twelve", + host="127.0.0.1", + port=5432, + database="traffic_ops", + sslmode="disable" + ) + return conn + Review Comment: please make sure you have an try except block for DB connection error and error handling `try: db_connection = psycopg2.connect(**db_info) print("Successfully connected to the database.") except OperationalError: print("Error connecting to the database :/")` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@trafficcontrol.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org