Skip to content

Commit

Permalink
Closing 2 open database connections.
Browse files Browse the repository at this point in the history
RE:#88
  • Loading branch information
phargogh committed Apr 18, 2023
1 parent 26da6c8 commit 10695c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,12 @@ def test_task_chain_single_thread(self):
# was a duplicate
database_path = os.path.join(
self.workspace_dir, taskgraph._TASKGRAPH_DATABASE_FILENAME)
with sqlite3.connect(database_path) as conn:
conn = sqlite3.connect(database_path)
with conn:
cursor = conn.cursor()
cursor.execute("SELECT * FROM taskgraph_data")
result = cursor.fetchall()
conn.close()
self.assertEqual(len(result), 4)

def test_task_broken_chain(self):
Expand Down Expand Up @@ -527,10 +529,13 @@ def test_empty_task(self):
# we shouldn't have anything in the database
database_path = os.path.join(
self.workspace_dir, taskgraph._TASKGRAPH_DATABASE_FILENAME)
with sqlite3.connect(database_path) as conn:

conn = sqlite3.connect(database_path)
with conn:
cursor = conn.cursor()
cursor.executescript("SELECT * FROM taskgraph_data")
result = cursor.fetchall()
conn.close()
self.assertEqual(len(result), 0)

def test_closed_graph(self):
Expand Down

0 comments on commit 10695c5

Please sign in to comment.