From 3fb4eee9f3dc97b88f528ce16ef371bafc6cfc73 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 21 Dec 2020 21:41:57 -0700 Subject: [PATCH] Yield fixtures are deprecated; the regular fixture does the same job --- tests/conftest.py | 14 +++++++------- tests/functional/openlp_core/api/test_tab.py | 2 +- .../functional/openlp_core/api/test_websockets.py | 2 +- .../functional/openlp_core/common/test_actions.py | 2 +- tests/functional/openlp_core/common/test_db.py | 2 +- .../openlp_core/common/test_httputils.py | 2 +- .../openlp_core/lib/test_mediamanageritem.py | 2 +- .../openlp_core/ui/media/test_mediacontroller.py | 2 +- .../openlp_core/ui/media/test_vlcplayer.py | 2 +- .../openlp_core/ui/test_firsttimeform.py | 2 +- .../openlp_core/ui/test_formattingtagsform.py | 2 +- tests/functional/openlp_core/ui/test_mainwindow.py | 2 +- .../functional/openlp_core/widgets/test_buttons.py | 2 +- tests/functional/openlp_core/widgets/test_views.py | 2 +- .../openlp_plugins/bibles/test_bibleimport.py | 4 ++-- tests/functional/openlp_plugins/bibles/test_lib.py | 2 +- .../openlp_plugins/bibles/test_mediaitem.py | 2 +- .../openlp_plugins/bibles/test_opensongimport.py | 4 ++-- .../openlp_plugins/bibles/test_upgrade.py | 4 ++-- .../openlp_plugins/images/test_upgrade.py | 4 ++-- .../openlp_plugins/presentations/conftest.py | 2 +- .../presentations/test_pdfcontroller.py | 2 +- .../presentations/test_presentationcontroller.py | 6 +++--- .../openlp_plugins/songs/test_mediaitem.py | 2 +- .../openlp_plugins/songs/test_openlyricsexport.py | 2 +- .../openlp_core/ui/test_firsttimeform.py | 2 +- .../openlp_plugins/custom/forms/test_customform.py | 2 +- .../custom/forms/test_customslideform.py | 2 +- .../images/forms/test_choosegroupform.py | 2 +- .../media/forms/test_mediaclipselectorform.py | 2 +- .../openlp_plugins/songs/forms/test_authorsform.py | 2 +- .../songs/forms/test_editsongform.py | 2 +- .../songs/forms/test_editverseform.py | 2 +- .../songs/forms/test_songmaintenanceform.py | 2 +- .../openlp_plugins/songs/forms/test_topicsform.py | 2 +- tests/openlp_core/projectors/conftest.py | 2 +- tests/openlp_core/projectors/test_projector_db.py | 2 +- .../projectors/test_projector_editform.py | 2 +- .../projectors/test_projector_sourceform.py | 2 +- .../projectors/test_projectormanager.py | 2 +- 40 files changed, 52 insertions(+), 52 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b16a998e0..e26936219 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -40,7 +40,7 @@ from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -@pytest.yield_fixture +@pytest.fixture def qapp(qtbot): """An instance of QApplication""" qt_api.QApplication.instance() @@ -49,7 +49,7 @@ def qapp(qtbot): del app -@pytest.yield_fixture +@pytest.fixture def mocked_qapp(): """A mocked instance of QApplication""" app = MagicMock() @@ -57,14 +57,14 @@ def mocked_qapp(): del app -@pytest.yield_fixture +@pytest.fixture def registry(): """An instance of the Registry""" yield Registry.create() Registry._instances = {} -@pytest.yield_fixture +@pytest.fixture def settings(qapp, registry): """A Settings() instance""" fd, ini_file = mkstemp('.ini') @@ -85,7 +85,7 @@ def settings(qapp, registry): os.unlink(Settings().fileName()) -@pytest.yield_fixture +@pytest.fixture def mock_settings(qapp, registry): """A Mock Settings() instance""" # Create and register a mock settings object to work with @@ -99,7 +99,7 @@ def mock_settings(qapp, registry): del mk_settings -@pytest.yield_fixture +@pytest.fixture def state(): yield State().load_settings() State._instances = {} @@ -112,7 +112,7 @@ def state_media(state): State().flush_preconditions() -@pytest.yield_fixture() +@pytest.fixture() def temp_folder(): t_folder = mkdtemp(prefix='openlp_') yield t_folder diff --git a/tests/functional/openlp_core/api/test_tab.py b/tests/functional/openlp_core/api/test_tab.py index f7ab507c2..9e5455d65 100644 --- a/tests/functional/openlp_core/api/test_tab.py +++ b/tests/functional/openlp_core/api/test_tab.py @@ -33,7 +33,7 @@ from openlp.core.common.registry import Registry ZERO_URL = '0.0.0.0' -@pytest.yield_fixture +@pytest.fixture def api_tab(settings): Registry().set_flag('website_version', '00-00-0000') parent = QtWidgets.QMainWindow() diff --git a/tests/functional/openlp_core/api/test_websockets.py b/tests/functional/openlp_core/api/test_websockets.py index 5ecfbc07d..61abe189c 100644 --- a/tests/functional/openlp_core/api/test_websockets.py +++ b/tests/functional/openlp_core/api/test_websockets.py @@ -29,7 +29,7 @@ from openlp.core.api.websockets import WebSocketServer from openlp.core.common.registry import Registry -@pytest.yield_fixture +@pytest.fixture def poller(settings): poll = Poller() yield poll diff --git a/tests/functional/openlp_core/common/test_actions.py b/tests/functional/openlp_core/common/test_actions.py index fb8d8d939..edf2e9269 100644 --- a/tests/functional/openlp_core/common/test_actions.py +++ b/tests/functional/openlp_core/common/test_actions.py @@ -34,7 +34,7 @@ MOCK_ACTION1 = MagicMock(**{'text.return_value': 'first'}) MOCK_ACTION2 = MagicMock(**{'text.return_value': 'second'}) -@pytest.yield_fixture +@pytest.fixture def action_list(settings): act_list = ActionList.get_instance() yield act_list diff --git a/tests/functional/openlp_core/common/test_db.py b/tests/functional/openlp_core/common/test_db.py index 5a143ffee..23cea802d 100644 --- a/tests/functional/openlp_core/common/test_db.py +++ b/tests/functional/openlp_core/common/test_db.py @@ -35,7 +35,7 @@ from openlp.core.lib.db import get_upgrade_op, init_db from tests.utils.constants import TEST_RESOURCES_PATH -@pytest.yield_fixture +@pytest.fixture def op(): tmp_folder = mkdtemp() db_path = os.path.join(TEST_RESOURCES_PATH, 'songs', 'songs-1.9.7.sqlite') diff --git a/tests/functional/openlp_core/common/test_httputils.py b/tests/functional/openlp_core/common/test_httputils.py index 422b30373..f87af541e 100644 --- a/tests/functional/openlp_core/common/test_httputils.py +++ b/tests/functional/openlp_core/common/test_httputils.py @@ -31,7 +31,7 @@ from openlp.core.common.httputils import ProxyMode, download_file, get_proxy_set get_random_user_agent, get_web_page -@pytest.yield_fixture +@pytest.fixture def temp_file(settings): tmp_file = os.path.join(tempfile.gettempdir(), 'testfile') yield tmp_file diff --git a/tests/functional/openlp_core/lib/test_mediamanageritem.py b/tests/functional/openlp_core/lib/test_mediamanageritem.py index a991e26f9..d6f6dc6cc 100644 --- a/tests/functional/openlp_core/lib/test_mediamanageritem.py +++ b/tests/functional/openlp_core/lib/test_mediamanageritem.py @@ -28,7 +28,7 @@ from openlp.core.common.registry import Registry from openlp.core.lib.mediamanageritem import MediaManagerItem -@pytest.yield_fixture +@pytest.fixture def media_env(): setup_patcher = patch('openlp.core.lib.mediamanageritem.MediaManagerItem._setup') setup_patcher.start() diff --git a/tests/functional/openlp_core/ui/media/test_mediacontroller.py b/tests/functional/openlp_core/ui/media/test_mediacontroller.py index 0a24ffbef..1d3a8df86 100644 --- a/tests/functional/openlp_core/ui/media/test_mediacontroller.py +++ b/tests/functional/openlp_core/ui/media/test_mediacontroller.py @@ -37,7 +37,7 @@ TEST_PATH = RESOURCE_PATH / 'media' TEST_MEDIA = [['avi_file.avi', 61495], ['mp3_file.mp3', 134426], ['mpg_file.mpg', 9404], ['mp4_file.mp4', 188336]] -@pytest.yield_fixture +@pytest.fixture def media_env(registry): """Local test setup""" Registry().register('service_manager', MagicMock()) diff --git a/tests/functional/openlp_core/ui/media/test_vlcplayer.py b/tests/functional/openlp_core/ui/media/test_vlcplayer.py index 03392c78d..27f1cfb28 100644 --- a/tests/functional/openlp_core/ui/media/test_vlcplayer.py +++ b/tests/functional/openlp_core/ui/media/test_vlcplayer.py @@ -35,7 +35,7 @@ from openlp.core.ui.media.vlcplayer import VlcPlayer, get_vlc from tests.helpers import MockDateTime -@pytest.yield_fixture +@pytest.fixture def vlc_env(): """Local test setup""" if 'VLC_PLUGIN_PATH' in os.environ: diff --git a/tests/functional/openlp_core/ui/test_firsttimeform.py b/tests/functional/openlp_core/ui/test_firsttimeform.py index b8148772c..fc3be46b4 100644 --- a/tests/functional/openlp_core/ui/test_firsttimeform.py +++ b/tests/functional/openlp_core/ui/test_firsttimeform.py @@ -48,7 +48,7 @@ def ftf_app(registry, qapp): Registry().register('application', qapp) -@pytest.yield_fixture() +@pytest.fixture() def download_env(registry): download_worker_patcher = patch('openlp.core.ui.firsttimeform.DownloadWorker') run_thread_patcher = patch('openlp.core.ui.firsttimeform.run_thread') diff --git a/tests/functional/openlp_core/ui/test_formattingtagsform.py b/tests/functional/openlp_core/ui/test_formattingtagsform.py index bb997a366..df4b0cf5d 100644 --- a/tests/functional/openlp_core/ui/test_formattingtagsform.py +++ b/tests/functional/openlp_core/ui/test_formattingtagsform.py @@ -27,7 +27,7 @@ from unittest.mock import MagicMock, call, patch from openlp.core.ui.formattingtagform import FormattingTagForm -@pytest.yield_fixture() +@pytest.fixture() def tagform_env(registry): setup_patcher = patch('openlp.core.ui.formattingtagform.FormattingTagForm._setup') mocked_setup_patcher = setup_patcher.start() diff --git a/tests/functional/openlp_core/ui/test_mainwindow.py b/tests/functional/openlp_core/ui/test_mainwindow.py index 4376ae6f9..78fe0f1b8 100644 --- a/tests/functional/openlp_core/ui/test_mainwindow.py +++ b/tests/functional/openlp_core/ui/test_mainwindow.py @@ -46,7 +46,7 @@ def _create_mock_action(parent, name, **kwargs): return action -@pytest.yield_fixture() +@pytest.fixture() def main_window(state, settings, mocked_qapp): app = Registry().get('application') app.set_busy_cursor = MagicMock() diff --git a/tests/functional/openlp_core/widgets/test_buttons.py b/tests/functional/openlp_core/widgets/test_buttons.py index 87645a0f9..bea5cab75 100644 --- a/tests/functional/openlp_core/widgets/test_buttons.py +++ b/tests/functional/openlp_core/widgets/test_buttons.py @@ -27,7 +27,7 @@ from unittest.mock import MagicMock, call, patch from openlp.core.widgets.buttons import ColorButton -@pytest.yield_fixture() +@pytest.fixture() def buttons_env(): change_color_patcher = patch('openlp.core.widgets.buttons.ColorButton.change_color') clicked_patcher = patch('openlp.core.widgets.buttons.ColorButton.clicked') diff --git a/tests/functional/openlp_core/widgets/test_views.py b/tests/functional/openlp_core/widgets/test_views.py index fffc8962a..0d6491730 100644 --- a/tests/functional/openlp_core/widgets/test_views.py +++ b/tests/functional/openlp_core/widgets/test_views.py @@ -37,7 +37,7 @@ def clapperboard(mock_settings): return UiIcons().clapperboard -@pytest.yield_fixture +@pytest.fixture def preview_widget_env(): """Local test setup""" parent_patcher = patch('openlp.core.widgets.views.ListPreviewWidget.parent') diff --git a/tests/functional/openlp_plugins/bibles/test_bibleimport.py b/tests/functional/openlp_plugins/bibles/test_bibleimport.py index c5ec471e8..4368a75b5 100644 --- a/tests/functional/openlp_plugins/bibles/test_bibleimport.py +++ b/tests/functional/openlp_plugins/bibles/test_bibleimport.py @@ -55,14 +55,14 @@ def error_message_box(settings): m_box.stop() -@pytest.yield_fixture() +@pytest.fixture() def mocked_open(): m_open = patch.object(Path, 'open') yield m_open.start() m_open.stop() -@pytest.yield_fixture() +@pytest.fixture() def mocked_setup(): s_up = patch('openlp.plugins.bibles.lib.db.BibleDB._setup') yield s_up.start() diff --git a/tests/functional/openlp_plugins/bibles/test_lib.py b/tests/functional/openlp_plugins/bibles/test_lib.py index 1ed99537d..a3da15ef1 100644 --- a/tests/functional/openlp_plugins/bibles/test_lib.py +++ b/tests/functional/openlp_plugins/bibles/test_lib.py @@ -29,7 +29,7 @@ from openlp.plugins.bibles import lib from openlp.plugins.bibles.lib import SearchResults, get_reference_match, update_reference_separators -@pytest.yield_fixture +@pytest.fixture def mocked_bible_test(registry): """Local test setup""" ret_value = MagicMock(**{'value.return_value': ''}) diff --git a/tests/functional/openlp_plugins/bibles/test_mediaitem.py b/tests/functional/openlp_plugins/bibles/test_mediaitem.py index 5409b684f..4c3e5176e 100644 --- a/tests/functional/openlp_plugins/bibles/test_mediaitem.py +++ b/tests/functional/openlp_plugins/bibles/test_mediaitem.py @@ -62,7 +62,7 @@ def mocked_timer(): return patch('openlp.plugins.bibles.lib.mediaitem.QtCore.QTimer').start() -@pytest.yield_fixture() +@pytest.fixture() def mocked_log(): return patch('openlp.plugins.bibles.lib.mediaitem.log').start() diff --git a/tests/functional/openlp_plugins/bibles/test_opensongimport.py b/tests/functional/openlp_plugins/bibles/test_opensongimport.py index 99c3ff91c..e7c1542a5 100644 --- a/tests/functional/openlp_plugins/bibles/test_opensongimport.py +++ b/tests/functional/openlp_plugins/bibles/test_opensongimport.py @@ -35,14 +35,14 @@ from tests.utils.constants import RESOURCE_PATH TEST_PATH = RESOURCE_PATH / 'bibles' -@pytest.yield_fixture +@pytest.fixture def manager(): db_man = patch('openlp.plugins.bibles.lib.db.Manager') yield db_man.start() db_man.stop() -@pytest.yield_fixture() +@pytest.fixture() def mocked_find_and_create_book(): facb = patch.object(BibleImport, 'find_and_create_book') yield facb.start() diff --git a/tests/functional/openlp_plugins/bibles/test_upgrade.py b/tests/functional/openlp_plugins/bibles/test_upgrade.py index b2be8bd0a..724eb305e 100644 --- a/tests/functional/openlp_plugins/bibles/test_upgrade.py +++ b/tests/functional/openlp_plugins/bibles/test_upgrade.py @@ -35,7 +35,7 @@ from openlp.plugins.bibles.lib import upgrade from tests.utils.constants import RESOURCE_PATH -@pytest.yield_fixture() +@pytest.fixture() def mock_message_box(): patched_message_box = patch('openlp.plugins.bibles.lib.upgrade.QtWidgets.QMessageBox') mocked_message_box = patched_message_box.start() @@ -51,7 +51,7 @@ def mock_message_box(): patched_message_box.stop() -@pytest.yield_fixture() +@pytest.fixture() def db_url(): tmp_path = Path(mkdtemp()) db_path = RESOURCE_PATH / 'bibles' / 'web-bible-2.4.6-proxy-meta-v1.sqlite' diff --git a/tests/functional/openlp_plugins/images/test_upgrade.py b/tests/functional/openlp_plugins/images/test_upgrade.py index 823fff2fb..3329f013d 100644 --- a/tests/functional/openlp_plugins/images/test_upgrade.py +++ b/tests/functional/openlp_plugins/images/test_upgrade.py @@ -35,14 +35,14 @@ from openlp.plugins.images.lib import upgrade from tests.utils.constants import RESOURCE_PATH -@pytest.yield_fixture() +@pytest.fixture() def temp_path(): tmp_path = Path(mkdtemp()) yield tmp_path shutil.rmtree(tmp_path, ignore_errors=True) -@pytest.yield_fixture() +@pytest.fixture() def db_url(): tmp_path = Path(mkdtemp()) db_path = RESOURCE_PATH / 'images' / 'image-v0.sqlite' diff --git a/tests/functional/openlp_plugins/presentations/conftest.py b/tests/functional/openlp_plugins/presentations/conftest.py index 1cc7f57ea..f5e27a02f 100644 --- a/tests/functional/openlp_plugins/presentations/conftest.py +++ b/tests/functional/openlp_plugins/presentations/conftest.py @@ -40,7 +40,7 @@ def media_item(settings): return m_item -@pytest.yield_fixture() +@pytest.fixture() def mock_plugin(temp_folder): m_plugin = MagicMock() m_plugin.settings_section = temp_folder diff --git a/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py b/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py index 6cc7f9caa..4ab8ed8cf 100644 --- a/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_pdfcontroller.py @@ -35,7 +35,7 @@ from openlp.plugins.presentations.lib.pdfcontroller import PdfController, PdfDoc from tests.utils.constants import RESOURCE_PATH -@pytest.yield_fixture() +@pytest.fixture() def pdf_env(settings, mock_plugin, mocked_qapp): temp_folder_path = Path(mkdtemp()) thumbnail_folder_path = Path(mkdtemp()) diff --git a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py index 1778920b1..e755b122b 100644 --- a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py @@ -32,7 +32,7 @@ from openlp.plugins.presentations.lib.presentationcontroller import Presentation FOLDER_TO_PATCH = 'openlp.plugins.presentations.lib.presentationcontroller.PresentationDocument.get_thumbnail_folder' -@pytest.yield_fixture() +@pytest.fixture() def get_thumbnail_folder(settings): gtf = patch('openlp.plugins.presentations.lib.presentationcontroller.PresentationDocument.get_thumbnail_folder', return_value=Path()) @@ -40,14 +40,14 @@ def get_thumbnail_folder(settings): gtf.stop() -@pytest.yield_fixture() +@pytest.fixture() def create_paths(settings): c_paths = patch('openlp.plugins.presentations.lib.presentationcontroller.create_paths') yield c_paths.start() c_paths.stop() -@pytest.yield_fixture() +@pytest.fixture() def setup(settings): s_up = patch('openlp.plugins.presentations.lib.presentationcontroller.PresentationDocument._setup') yield s_up.start() diff --git a/tests/functional/openlp_plugins/songs/test_mediaitem.py b/tests/functional/openlp_plugins/songs/test_mediaitem.py index 5f2fa23a6..25e92947c 100644 --- a/tests/functional/openlp_plugins/songs/test_mediaitem.py +++ b/tests/functional/openlp_plugins/songs/test_mediaitem.py @@ -88,7 +88,7 @@ ${title}
} -@pytest.yield_fixture +@pytest.fixture def media_item(settings): Registry().register('service_list', MagicMock()) Registry().register('main_window', MagicMock()) diff --git a/tests/functional/openlp_plugins/songs/test_openlyricsexport.py b/tests/functional/openlp_plugins/songs/test_openlyricsexport.py index 4faf1e11d..1a637995a 100644 --- a/tests/functional/openlp_plugins/songs/test_openlyricsexport.py +++ b/tests/functional/openlp_plugins/songs/test_openlyricsexport.py @@ -32,7 +32,7 @@ import pytest from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport -@pytest.yield_fixture +@pytest.fixture def temp_folder(): temp_path = Path(mkdtemp()) yield temp_path diff --git a/tests/interfaces/openlp_core/ui/test_firsttimeform.py b/tests/interfaces/openlp_core/ui/test_firsttimeform.py index 5424d3a50..a54a1cd4b 100644 --- a/tests/interfaces/openlp_core/ui/test_firsttimeform.py +++ b/tests/interfaces/openlp_core/ui/test_firsttimeform.py @@ -33,7 +33,7 @@ sample_theme_data = {'file_name': 'BlueBurst.otz', 'sha256': 'sha_256_hash', 'thumbnail': 'BlueBurst.png', 'title': 'Blue Burst'} -@pytest.yield_fixture() +@pytest.fixture() def mocked_set_icon(mock_settings): move_to_thread_patcher = patch('openlp.core.ui.firsttimeform.DownloadWorker.moveToThread').start() set_icon_patcher = patch('openlp.core.ui.firsttimeform.ThemeListWidgetItem.setIcon').start() diff --git a/tests/interfaces/openlp_plugins/custom/forms/test_customform.py b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py index 25d82927e..240e62b29 100644 --- a/tests/interfaces/openlp_plugins/custom/forms/test_customform.py +++ b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py @@ -29,7 +29,7 @@ from PyQt5 import QtCore, QtTest, QtWidgets from openlp.plugins.custom.forms.editcustomform import EditCustomForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() media_item = MagicMock() diff --git a/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py b/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py index d3c2e2b35..0aa9cdf19 100644 --- a/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py +++ b/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py @@ -30,7 +30,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.custom.forms.editcustomslideform import EditCustomSlideForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/interfaces/openlp_plugins/images/forms/test_choosegroupform.py b/tests/interfaces/openlp_plugins/images/forms/test_choosegroupform.py index fd26e43ca..4a297c4bc 100644 --- a/tests/interfaces/openlp_plugins/images/forms/test_choosegroupform.py +++ b/tests/interfaces/openlp_plugins/images/forms/test_choosegroupform.py @@ -30,7 +30,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.images.forms.choosegroupform import ChooseGroupForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py b/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py index be424c009..725c4c7b9 100644 --- a/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py +++ b/tests/interfaces/openlp_plugins/media/forms/test_mediaclipselectorform.py @@ -36,7 +36,7 @@ if os.name == 'nt' and not get_vlc(): raise SkipTest('Windows without VLC, skipping this test since it cannot run without vlc') -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() vlc_patcher = patch('openlp.plugins.media.forms.mediaclipselectorform.get_vlc') diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py b/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py index 8742ff179..71da2cfba 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py @@ -30,7 +30,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.songs.forms.authorsform import AuthorsForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py b/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py index b69e51a68..760ff3148 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py @@ -31,7 +31,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.songs.forms.editsongform import EditSongForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py b/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py index 26ae8cc27..76f09179f 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py @@ -29,7 +29,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.songs.forms.editverseform import EditVerseForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_songmaintenanceform.py b/tests/interfaces/openlp_plugins/songs/forms/test_songmaintenanceform.py index 5d6eac9c3..fd7736cfc 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_songmaintenanceform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_songmaintenanceform.py @@ -31,7 +31,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.songs.forms.songmaintenanceform import SongMaintenanceForm -@pytest.yield_fixture() +@pytest.fixture() def form_env(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py b/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py index ac86f819b..a7c6e25f5 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py @@ -29,7 +29,7 @@ from openlp.core.common.registry import Registry from openlp.plugins.songs.forms.topicsform import TopicsForm -@pytest.yield_fixture() +@pytest.fixture() def form(settings): main_window = QtWidgets.QMainWindow() Registry().register('main_window', main_window) diff --git a/tests/openlp_core/projectors/conftest.py b/tests/openlp_core/projectors/conftest.py index a92825f47..ed2cfbae1 100644 --- a/tests/openlp_core/projectors/conftest.py +++ b/tests/openlp_core/projectors/conftest.py @@ -27,7 +27,7 @@ from openlp.core.projectors.pjlink import PJLink from tests.resources.projector.data import TEST1_DATA -@pytest.yield_fixture() +@pytest.fixture() def pjlink(): pj_link = PJLink(Projector(**TEST1_DATA), no_poll=True) yield pj_link diff --git a/tests/openlp_core/projectors/test_projector_db.py b/tests/openlp_core/projectors/test_projector_db.py index ad415a2ba..c7bdb18bb 100644 --- a/tests/openlp_core/projectors/test_projector_db.py +++ b/tests/openlp_core/projectors/test_projector_db.py @@ -102,7 +102,7 @@ def test_upgrade_old_projector_db(temp_folder): assert updated_to_version == latest_version, 'The projector DB should have been upgrade to the latest version' -@pytest.yield_fixture() +@pytest.fixture() def projector(temp_folder, settings): """ Set up anything necessary for all tests diff --git a/tests/openlp_core/projectors/test_projector_editform.py b/tests/openlp_core/projectors/test_projector_editform.py index 41704131f..935bb1870 100644 --- a/tests/openlp_core/projectors/test_projector_editform.py +++ b/tests/openlp_core/projectors/test_projector_editform.py @@ -30,7 +30,7 @@ from openlp.core.projectors.editform import ProjectorEditForm from tests.resources.projector.data import TEST1_DATA, TEST_DB -@pytest.yield_fixture() +@pytest.fixture() def projector_form(settings): with patch('openlp.core.projectors.db.init_url') as mocked_init_url: mocked_init_url.return_value = 'sqlite:///' + TEST_DB diff --git a/tests/openlp_core/projectors/test_projector_sourceform.py b/tests/openlp_core/projectors/test_projector_sourceform.py index b172e4005..eabd7d68b 100644 --- a/tests/openlp_core/projectors/test_projector_sourceform.py +++ b/tests/openlp_core/projectors/test_projector_sourceform.py @@ -34,7 +34,7 @@ from openlp.core.projectors.sourceselectform import SourceSelectSingle, source_g from tests.resources.projector.data import TEST1_DATA, TEST_DB -@pytest.yield_fixture() +@pytest.fixture() def projector_env(settings): with patch('openlp.core.projectors.db.init_url') as mocked_init_url: mocked_init_url.return_value = 'sqlite:///{}'.format(TEST_DB) diff --git a/tests/openlp_core/projectors/test_projectormanager.py b/tests/openlp_core/projectors/test_projectormanager.py index b110763a5..e696588e1 100644 --- a/tests/openlp_core/projectors/test_projectormanager.py +++ b/tests/openlp_core/projectors/test_projectormanager.py @@ -30,7 +30,7 @@ from openlp.core.projectors.manager import ProjectorManager from tests.resources.projector.data import TEST_DB -@pytest.yield_fixture() +@pytest.fixture() def projector_manager(settings): with patch('openlp.core.projectors.db.init_url') as mocked_init_url: mocked_init_url.return_value = 'sqlite:///%s' % TEST_DB