From 768c05bb521716873e0ee1050bab360f09345a5b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 20 Sep 2022 22:45:04 +0300 Subject: Revert "Use member variable `self.conn` to avoid test failure" This reverts commit 4fafdfd8487ddf61105b2a5ca92534c8014c1db4. While using `self.conn.cursor()` works in the tests, it will not work in the application since the point of initialisation could be very different from the point where the 'property' is called. --- wqflask/base/species.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/base/species.py b/wqflask/base/species.py index 403e0bbb..0ee04630 100644 --- a/wqflask/base/species.py +++ b/wqflask/base/species.py @@ -47,7 +47,7 @@ class Chromosomes: def chromosomes(self) -> OrderedDict: """Lazily fetch the chromosomes""" chromosomes = OrderedDict() - with self.conn.cursor() as cursor: + with database_connection() as conn, conn.cursor() as cursor: if self.species is not None: cursor.execute( "SELECT Chr_Length.Name, Chr_Length.OrderId, Length " -- cgit v1.2.3