From fbaad518117a735f03a1a49bc3a8765cc862574c Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 24 Nov 2014 23:18:32 +0200 Subject: [PATCH] Try to fix the segfault --- .../openlp_core_common/test_historycombobox.py | 3 ++- .../openlp_core_lib/test_pluginmanager.py | 18 +++++++++--------- .../openlp_core_lib/test_searchedit.py | 5 +++++ tests/interfaces/openlp_core_ui/__init__.py | 5 ++++- .../openlp_core_ui/test_servicemanager.py | 2 ++ .../openlp_core_ui/test_thememanager.py | 2 +- .../openlp_plugins/bibles/test_lib_manager.py | 1 + .../bibles/test_lib_parse_reference.py | 1 + .../custom/forms/test_customform.py | 2 +- .../media/forms/test_mediaclipselectorform.py | 2 +- 10 files changed, 27 insertions(+), 14 deletions(-) diff --git a/tests/interfaces/openlp_core_common/test_historycombobox.py b/tests/interfaces/openlp_core_common/test_historycombobox.py index 2d5f28d5e..da1dae2e1 100644 --- a/tests/interfaces/openlp_core_common/test_historycombobox.py +++ b/tests/interfaces/openlp_core_common/test_historycombobox.py @@ -50,8 +50,9 @@ class TestHistoryComboBox(TestCase, TestMixin): def tearDown(self): del self.combo + del self.main_window - def getItems_test(self): + def get_items_test(self): """ Test the getItems() method """ diff --git a/tests/interfaces/openlp_core_lib/test_pluginmanager.py b/tests/interfaces/openlp_core_lib/test_pluginmanager.py index e67e9bb40..e270f868b 100644 --- a/tests/interfaces/openlp_core_lib/test_pluginmanager.py +++ b/tests/interfaces/openlp_core_lib/test_pluginmanager.py @@ -86,12 +86,12 @@ class TestPluginManager(TestCase, TestMixin): # THEN: We should find the "Songs", "Bibles", etc in the plugins list plugin_names = [plugin.name for plugin in plugin_manager.plugins] - assert 'songs' in plugin_names, 'There should be a "songs" plugin.' - assert 'bibles' in plugin_names, 'There should be a "bibles" plugin.' - assert 'presentations' in plugin_names, 'There should be a "presentations" plugin.' - assert 'images' in plugin_names, 'There should be a "images" plugin.' - assert 'media' in plugin_names, 'There should be a "media" plugin.' - assert 'custom' in plugin_names, 'There should be a "custom" plugin.' - assert 'songusage' in plugin_names, 'There should be a "songusage" plugin.' - assert 'alerts' in plugin_names, 'There should be a "alerts" plugin.' - assert 'remotes' in plugin_names, 'There should be a "remotes" plugin.' + self.assertIn('songs', plugin_names, 'There should be a "songs" plugin') + self.assertIn('bibles', plugin_names, 'There should be a "bibles" plugin') + self.assertIn('presentations', plugin_names, 'There should be a "presentations" plugin') + self.assertIn('images', plugin_names, 'There should be a "images" plugin') + self.assertIn('media', plugin_names, 'There should be a "media" plugin') + self.assertIn('custom', plugin_names, 'There should be a "custom" plugin') + self.assertIn('songusage', plugin_names, 'There should be a "songusage" plugin') + self.assertIn('alerts', plugin_names, 'There should be a "alerts" plugin') + self.assertIn('remotes', plugin_names, 'There should be a "remotes" plugin') diff --git a/tests/interfaces/openlp_core_lib/test_searchedit.py b/tests/interfaces/openlp_core_lib/test_searchedit.py index e2ce68b0c..8095c543f 100644 --- a/tests/interfaces/openlp_core_lib/test_searchedit.py +++ b/tests/interfaces/openlp_core_lib/test_searchedit.py @@ -35,10 +35,14 @@ from PyQt4 import QtCore, QtGui, QtTest from openlp.core.common import Registry from openlp.core.lib.searchedit import SearchEdit + from tests.helpers.testmixin import TestMixin class SearchTypes(object): + """ + Types of search + """ First = 0 Second = 1 @@ -69,6 +73,7 @@ class TestSearchEdit(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ + del self.search_edit del self.main_window def set_search_types_test(self): diff --git a/tests/interfaces/openlp_core_ui/__init__.py b/tests/interfaces/openlp_core_ui/__init__.py index 747685c24..602f7c70e 100644 --- a/tests/interfaces/openlp_core_ui/__init__.py +++ b/tests/interfaces/openlp_core_ui/__init__.py @@ -31,14 +31,17 @@ Module-level functions for the functional test suite """ import os -from tests.interfaces import patch from openlp.core.common import is_win +from tests.interfaces import patch from .test_projectormanager import tmpfile def setUp(): + """ + Set up this module of tests + """ if not is_win(): # Wine creates a sharing violation during tests. Ignore. try: diff --git a/tests/interfaces/openlp_core_ui/test_servicemanager.py b/tests/interfaces/openlp_core_ui/test_servicemanager.py index a08e4a1f1..fdd0a31bc 100644 --- a/tests/interfaces/openlp_core_ui/test_servicemanager.py +++ b/tests/interfaces/openlp_core_ui/test_servicemanager.py @@ -57,6 +57,8 @@ class TestServiceManager(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ + del self.service_manager + del self.main_window def basic_service_manager_test(self): """ diff --git a/tests/interfaces/openlp_core_ui/test_thememanager.py b/tests/interfaces/openlp_core_ui/test_thememanager.py index 792c9f9f8..1c2e065a8 100644 --- a/tests/interfaces/openlp_core_ui/test_thememanager.py +++ b/tests/interfaces/openlp_core_ui/test_thememanager.py @@ -54,7 +54,7 @@ class TestThemeManager(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ - + del self.theme_manager self.destroy_settings() def initialise_test(self): diff --git a/tests/interfaces/openlp_plugins/bibles/test_lib_manager.py b/tests/interfaces/openlp_plugins/bibles/test_lib_manager.py index 7296cfc08..0218cbc17 100644 --- a/tests/interfaces/openlp_plugins/bibles/test_lib_manager.py +++ b/tests/interfaces/openlp_plugins/bibles/test_lib_manager.py @@ -73,6 +73,7 @@ class TestBibleManager(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ + del self.manager self.destroy_settings() def get_books_test(self): diff --git a/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py b/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py index e20105ea1..1b8570a38 100644 --- a/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py +++ b/tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py @@ -73,6 +73,7 @@ class TestBibleManager(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ + del self.manager self.destroy_settings() def parse_reference_one_test(self): diff --git a/tests/interfaces/openlp_plugins/custom/forms/test_customform.py b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py index 577048378..52b0db950 100644 --- a/tests/interfaces/openlp_plugins/custom/forms/test_customform.py +++ b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py @@ -34,7 +34,7 @@ from unittest import TestCase from PyQt4 import QtGui, QtTest, QtCore from openlp.core.common import Registry -# Import needed due to import problems. +# TODO: FIXME: Import needed due to horrible bad imports from openlp.plugins.custom.lib.mediaitem import CustomMediaItem from openlp.plugins.custom.forms.editcustomform import EditCustomForm from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py b/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py index 45e1dee41..2674843f5 100644 --- a/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py +++ b/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py @@ -76,8 +76,8 @@ class TestMediaClipSelectorForm(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ - self.vlc_patcher.stop() del self.form + self.vlc_patcher.stop() del self.main_window def basic_test(self):