Fix weird test bug.

This commit is contained in:
Tomas Groth 2016-03-12 22:23:06 +01:00
parent 4cea5e8b43
commit 4b57a2bae6
1 changed files with 9 additions and 4 deletions

View File

@ -32,7 +32,7 @@ from PyQt5 import QtWidgets
from openlp.core.common import Registry, Settings from openlp.core.common import Registry, Settings
from openlp.core.lib.pluginmanager import PluginManager from openlp.core.lib.pluginmanager import PluginManager
from tests.interfaces import MagicMock from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
@ -45,13 +45,12 @@ class TestPluginManager(TestCase, TestMixin):
""" """
Some pre-test setup required. Some pre-test setup required.
""" """
Settings.setDefaultFormat(Settings.IniFormat) self.setup_application()
self.build_settings() self.build_settings()
self.temp_dir = mkdtemp('openlp') self.temp_dir = mkdtemp('openlp')
Settings().setValue('advanced/data path', self.temp_dir) Settings().setValue('advanced/data path', self.temp_dir)
Registry.create() Registry.create()
Registry().register('service_list', MagicMock()) Registry().register('service_list', MagicMock())
self.setup_application()
self.main_window = QtWidgets.QMainWindow() self.main_window = QtWidgets.QMainWindow()
Registry().register('main_window', self.main_window) Registry().register('main_window', self.main_window)
@ -64,7 +63,13 @@ class TestPluginManager(TestCase, TestMixin):
gc.collect() gc.collect()
shutil.rmtree(self.temp_dir) shutil.rmtree(self.temp_dir)
def find_plugins_test(self): @patch('openlp.plugins.songusage.lib.db.init_schema')
@patch('openlp.plugins.songs.lib.db.init_schema')
@patch('openlp.plugins.images.lib.db.init_schema')
@patch('openlp.plugins.custom.lib.db.init_schema')
@patch('openlp.plugins.alerts.lib.db.init_schema')
@patch('openlp.plugins.bibles.lib.db.init_schema')
def find_plugins_test(self, mocked_is1, mocked_is2, mocked_is3, mocked_is4, mocked_is5, mocked_is6):
""" """
Test the find_plugins() method to ensure it imports the correct plugins Test the find_plugins() method to ensure it imports the correct plugins
""" """