Revert attempted fixes to projector tests. Just don't use windows...

This commit is contained in:
Tomas Groth 2014-12-01 08:33:16 +00:00
parent 7d2f2d147c
commit e9410de13c
2 changed files with 11 additions and 20 deletions

View File

@ -32,7 +32,7 @@ record functions.
PREREQUISITE: add_record() and get_all() functions validated. PREREQUISITE: add_record() and get_all() functions validated.
""" """
import sys
from unittest import TestCase from unittest import TestCase
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
@ -85,14 +85,10 @@ class TestProjectorDB(TestCase):
Set up anything necessary for all tests Set up anything necessary for all tests
""" """
if not hasattr(self, 'projector'): if not hasattr(self, 'projector'):
# We need to patch this in different ways to make to work an all versions with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
if sys.version_info > (3, 4, 0): mocked_init_url.start()
mocked_init_url = patch('openlp.core.lib.db.init_url') mocked_init_url.return_value = 'sqlite:///%s' % tmpfile
else: self.projector = ProjectorDB()
mocked_init_url = patch('openlp.core.lib.projector.db.init_url')
mocked_init_url.start()
mocked_init_url.return_value = 'sqlite:///%s' % tmpfile
self.projector = ProjectorDB()
def find_record_by_ip_test(self): def find_record_by_ip_test(self):
""" """

View File

@ -31,7 +31,6 @@ Interface tests to test the themeManager class and related methods.
""" """
import os import os
import sys
from unittest import TestCase from unittest import TestCase
from openlp.core.common import Registry, Settings from openlp.core.common import Registry, Settings
@ -58,16 +57,12 @@ class TestProjectorManager(TestCase, TestMixin):
self.setup_application() self.setup_application()
Registry.create() Registry.create()
if not hasattr(self, 'projector_manager'): if not hasattr(self, 'projector_manager'):
# We need to patch this in different ways to make to work an all versions with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url:
if sys.version_info > (3, 4, 0): mocked_init_url.start()
mocked_init_url = patch('openlp.core.lib.db.init_url') mocked_init_url.return_value = 'sqlite:///%s' % tmpfile
else: self.projectordb = ProjectorDB()
mocked_init_url = patch('openlp.core.lib.projector.db.init_url') if not hasattr(self, 'projector_manager'):
mocked_init_url.start() self.projector_manager = ProjectorManager(projectordb=self.projectordb)
mocked_init_url.return_value = 'sqlite:///%s' % tmpfile
self.projectordb = ProjectorDB()
if not hasattr(self, 'projector_manager'):
self.projector_manager = ProjectorManager(projectordb=self.projectordb)
def tearDown(self): def tearDown(self):
""" """