Skip to content
Snippets Groups Projects
Commit a7a0e6ac authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

Sjekker om filer eksisterer før de slettes i testene

parent 2ea25438
No related branches found
No related tags found
1 merge request!40#38 #39 Eksporter og importer SOI til/fra fil
Pipeline #77449 passed
......@@ -50,7 +50,10 @@ class ExportTest(unittest.TestCase):
self.assertTrue(os.path.exists(file_path_small))
# Delete generated files
os.remove(file_path_full)
os.remove(file_path_small)
database.conn.close()
os.remove(TESTDBPATH)
if os.path.exists(file_path_full):
os.remove(file_path_full)
if os.path.exists(file_path_small):
os.remove(file_path_small)
if os.path.exists(TESTDBPATH):
database.conn.close()
os.remove(TESTDBPATH)
......@@ -295,8 +295,8 @@ class DatabaseTest(unittest.TestCase):
def delete_db(self):
"""Delete generated database-file."""
self.database.conn.close()
if os.path.exists(TESTDBPATH):
self.database.conn.close()
os.remove(TESTDBPATH)
......
......@@ -34,8 +34,8 @@ class TestMainWindow(unittest.TestCase):
def delete_db(self):
"""Delete generated 'testDatabase'-file."""
self.test_mw.database.conn.close()
if os.path.exists(TESTDBPATH):
self.test_mw.database.conn.close()
os.remove(TESTDBPATH)
......
......@@ -135,5 +135,7 @@ class SerializeTest(unittest.TestCase):
self.assertEqual(MODULES[1]["meta"], soi.modules[1]["meta"])
# Delete exported SOI-files
os.remove(self.file_path)
os.remove(invalid_soi_file_path)
if os.path.exists(self.file_path):
os.remove(self.file_path)
if os.path.exists(invalid_soi_file_path):
os.remove(invalid_soi_file_path)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment