From e30f9a9b746f7dcdc8707e66cc65e580e6f83f47 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 8 Mar 2022 08:07:38 +0300 Subject: Fix tests, and issues caught by tests Fix some issues caught by tests due to changes introducing the hand-off of the partial correlations computations to an external process Fix some issues due to the changes that introduce context managers for database connections Update some tests to take the above two changes into consideration --- tests/performance/perf_query.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tests/performance') diff --git a/tests/performance/perf_query.py b/tests/performance/perf_query.py index c22dcf5..e534e9b 100644 --- a/tests/performance/perf_query.py +++ b/tests/performance/perf_query.py @@ -28,15 +28,13 @@ def timer(func): def query_executor(query: str, fetch_all: bool = True): """function to execute a query""" - conn, _ = database_connector() + with database_connector() as conn: + with conn.cursor() as cursor: + cursor.execute(query) - with conn: - cursor = conn.cursor() - cursor.execute(query) - - if fetch_all: - return cursor.fetchall() - return cursor.fetchone() + if fetch_all: + return cursor.fetchall() + return cursor.fetchone() def fetch_probeset_query(dataset_name: str): -- cgit v1.2.3