Fix the tests on Windows too

This commit is contained in:
Tomas Groth 2016-01-07 23:57:01 +02:00 committed by Raoul Snyman
parent 7853706479
commit a61430a59f
2 changed files with 9 additions and 10 deletions

View File

@ -96,6 +96,7 @@ class TestProjectorDB(TestCase):
"""
Clean up
"""
self.projector.session.close()
self.projector = None
def find_record_by_ip_test(self):

View File

@ -22,7 +22,6 @@
"""
Interface tests to test the themeManager class and related methods.
"""
import os
from unittest import TestCase
@ -33,9 +32,7 @@ from tests.helpers.testmixin import TestMixin
from openlp.core.ui import ProjectorManager, ProjectorEditForm
from openlp.core.lib.projector.db import Projector, ProjectorDB
from tests.resources.projector.data import TEST1_DATA, TEST2_DATA, TEST3_DATA
tmpfile = '/tmp/openlp-test-projectormanager.sql'
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
class TestProjectorManager(TestCase, TestMixin):
@ -49,12 +46,13 @@ class TestProjectorManager(TestCase, TestMixin):
self.build_settings()
self.setup_application()
Registry.create()
if not hasattr(self, 'projector_manager'):
with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
mocked_init_url.return_value = 'sqlite:///%s' % tmpfile
self.projectordb = ProjectorDB()
if not hasattr(self, 'projector_manager'):
self.projector_manager = ProjectorManager(projectordb=self.projectordb)
with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
if os.path.exists(TEST_DB):
os.unlink(TEST_DB)
mocked_init_url.return_value = 'sqlite:///%s' % TEST_DB
self.projectordb = ProjectorDB()
if not hasattr(self, 'projector_manager'):
self.projector_manager = ProjectorManager(projectordb=self.projectordb)
def tearDown(self):
"""