forked from openlp/openlp
Use a in-memory sqlite DB for projector test, instead of filebased. Fixes a filelock issue in windows tests.
This commit is contained in:
parent
cffad28749
commit
dc3cd41576
|
@ -31,8 +31,6 @@ Interface tests to test the openlp.core.ui.projector.editform.ProjectorEditForm(
|
||||||
class and methods.
|
class and methods.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import tempfile
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
|
@ -43,8 +41,6 @@ from tests.functional import patch
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.resources.projector.data import TEST1_DATA, TEST2_DATA
|
from tests.resources.projector.data import TEST1_DATA, TEST2_DATA
|
||||||
|
|
||||||
tmpfile = tempfile.mkstemp(prefix='openlp-test-projectormanager', suffix='.sql')[1]
|
|
||||||
|
|
||||||
|
|
||||||
class TestProjectorEditForm(TestCase, TestMixin):
|
class TestProjectorEditForm(TestCase, TestMixin):
|
||||||
"""
|
"""
|
||||||
|
@ -60,8 +56,7 @@ class TestProjectorEditForm(TestCase, TestMixin):
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
Registry.create()
|
Registry.create()
|
||||||
with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
|
with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
|
||||||
mocked_init_url.start()
|
mocked_init_url.return_value = 'sqlite://'
|
||||||
mocked_init_url.return_value = 'sqlite:///{}'.format(tmpfile)
|
|
||||||
self.projectordb = ProjectorDB()
|
self.projectordb = ProjectorDB()
|
||||||
self.projector_form = ProjectorEditForm(projectordb=self.projectordb)
|
self.projector_form = ProjectorEditForm(projectordb=self.projectordb)
|
||||||
|
|
||||||
|
@ -74,7 +69,6 @@ class TestProjectorEditForm(TestCase, TestMixin):
|
||||||
"""
|
"""
|
||||||
self.projectordb.session.close()
|
self.projectordb.session.close()
|
||||||
del(self.projector_form)
|
del(self.projector_form)
|
||||||
os.remove(tmpfile)
|
|
||||||
self.destroy_settings()
|
self.destroy_settings()
|
||||||
|
|
||||||
def edit_form_add_projector_test(self):
|
def edit_form_add_projector_test(self):
|
||||||
|
|
Loading…
Reference in New Issue