From d914deacd200197771ddb47db1628e826e41e482 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Tue, 21 Oct 2014 08:41:09 -0700 Subject: [PATCH] Fix projector test cleanups --- tests/interfaces/openlp_core_ui/__init__.py | 7 +++++++ .../openlp_core_ui/test_projectormanager.py | 11 ++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/interfaces/openlp_core_ui/__init__.py b/tests/interfaces/openlp_core_ui/__init__.py index 34420bdb8..747685c24 100644 --- a/tests/interfaces/openlp_core_ui/__init__.py +++ b/tests/interfaces/openlp_core_ui/__init__.py @@ -30,6 +30,7 @@ Module-level functions for the functional test suite """ +import os from tests.interfaces import patch from openlp.core.common import is_win @@ -51,3 +52,9 @@ def tearDown(): Ensure test suite has been cleaned up after tests """ patch.stopall() + if not is_win(): + try: + # In case of changed schema, remove old test file + os.remove(tmpfile) + except FileNotFoundError: + pass diff --git a/tests/interfaces/openlp_core_ui/test_projectormanager.py b/tests/interfaces/openlp_core_ui/test_projectormanager.py index 65d43dec5..6ead7c336 100644 --- a/tests/interfaces/openlp_core_ui/test_projectormanager.py +++ b/tests/interfaces/openlp_core_ui/test_projectormanager.py @@ -44,12 +44,6 @@ from tests.resources.projector.data import TEST1_DATA, TEST2_DATA, TEST3_DATA tmpfile = '/tmp/openlp-test-projectormanager.sql' -try: - # In case of changed schema, remove old test file - os.remove(tmpfile) -except FileNotFoundError: - pass - class TestProjectorManager(TestCase, TestMixin): """ @@ -72,8 +66,11 @@ class TestProjectorManager(TestCase, TestMixin): def tearDown(self): """ - Delete all the C++ objects at the end so that we don't have a segfault + Remove test database. + Delete all the C++ objects at the end so that we don't have a segfault. """ + self.projectordb.session.close() + del(self.projector_manager) self.destroy_settings() def bootstrap_initialise_test(self):