From 2ea254386dd75047626efb65585372de01f23fb5 Mon Sep 17 00:00:00 2001
From: "Anders H. Rebner" <anderhre@stud.ntnu.no>
Date: Fri, 27 Mar 2020 08:39:54 +0100
Subject: [PATCH] =?UTF-8?q?Lukker=20db-connection=20for=20=C3=A5=20unng?=
 =?UTF-8?q?=C3=A5=20error=20i=20unittest?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 test/test_codebook_to_pdf.py | 1 +
 test/test_database.py        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/test_codebook_to_pdf.py b/test/test_codebook_to_pdf.py
index ca6bd30..3dafcf7 100644
--- a/test/test_codebook_to_pdf.py
+++ b/test/test_codebook_to_pdf.py
@@ -52,4 +52,5 @@ class ExportTest(unittest.TestCase):
         # Delete generated files
         os.remove(file_path_full)
         os.remove(file_path_small)
+        database.conn.close()
         os.remove(TESTDBPATH)
diff --git a/test/test_database.py b/test/test_database.py
index c9a6598..84a5b2d 100644
--- a/test/test_database.py
+++ b/test/test_database.py
@@ -295,7 +295,7 @@ class DatabaseTest(unittest.TestCase):
 
     def delete_db(self):
         """Delete generated database-file."""
-        del self.database
+        self.database.conn.close()
         if os.path.exists(TESTDBPATH):
             os.remove(TESTDBPATH)
 
-- 
GitLab