Try to fix paths in coverage report generation

- Add the local path to coverage config
- Fix the paths before generating an HTML report
This commit is contained in:
Tim Bentley 2019-12-04 20:01:02 +00:00 committed by Raoul Snyman
parent 205442fed7
commit 9fd6752a83
4 changed files with 1045 additions and 1020 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@
.vscode .vscode
.eggs .eggs
.venv .venv
.mypy_cache
OpenLP.egg-info OpenLP.egg-info
\#*\# \#*\#
__pycache__ __pycache__

View File

@ -34,7 +34,6 @@ from openlp.core.common.actions import ActionList, CategoryOrder
from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.i18n import UiStrings, translate
from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.mixins import LogMixin, RegistryProperties
from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.registry import Registry, RegistryBase
from openlp.core.common.settings import Settings
from openlp.core.display.screens import ScreenList from openlp.core.display.screens import ScreenList
from openlp.core.display.window import DisplayWindow from openlp.core.display.window import DisplayWindow
from openlp.core.lib import ServiceItemAction, image_to_byte from openlp.core.lib import ServiceItemAction, image_to_byte
@ -324,7 +323,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.play_slides_once = create_action(self, 'playSlidesOnce', text=UiStrings().PlaySlidesToEnd, self.play_slides_once = create_action(self, 'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
icon=UiIcons().clock, checked=False, can_shortcuts=True, icon=UiIcons().clock, checked=False, can_shortcuts=True,
category=self.category, triggers=self.on_play_slides_once) category=self.category, triggers=self.on_play_slides_once)
if Settings().value(self.main_window.advanced_settings_section + '/slide limits') == SlideLimits.Wrap: if self.settings.value(self.main_window.advanced_settings_section + '/slide limits') == SlideLimits.Wrap:
self.play_slides_menu.setDefaultAction(self.play_slides_loop) self.play_slides_menu.setDefaultAction(self.play_slides_loop)
else: else:
self.play_slides_menu.setDefaultAction(self.play_slides_once) self.play_slides_menu.setDefaultAction(self.play_slides_once)
@ -697,13 +696,13 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
""" """
Adjusts the value of the ``delay_spin_box`` to the given one. Adjusts the value of the ``delay_spin_box`` to the given one.
""" """
self.delay_spin_box.setValue(Settings().value('core/loop delay')) self.delay_spin_box.setValue(self.settings.value('core/loop delay'))
def update_slide_limits(self): def update_slide_limits(self):
""" """
Updates the Slide Limits variable from the settings. Updates the Slide Limits variable from the settings.
""" """
self.slide_limits = Settings().value(self.main_window.advanced_settings_section + '/slide limits') self.slide_limits = self.settings.value(self.main_window.advanced_settings_section + '/slide limits')
def enable_tool_bar(self, item): def enable_tool_bar(self, item):
""" """
@ -737,7 +736,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.play_slides_loop.setIcon(UiIcons().clock) self.play_slides_loop.setIcon(UiIcons().clock)
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop) self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
if item.is_text(): if item.is_text():
if (Settings().value(self.main_window.songs_settings_section + '/display songbar') and if (self.settings.value(self.main_window.songs_settings_section + '/display songbar') and
not self.song_menu.menu().isEmpty()): not self.song_menu.menu().isEmpty()):
self.toolbar.set_widget_visible('song_menu', True) self.toolbar.set_widget_visible('song_menu', True)
if item.is_capable(ItemCapabilities.CanLoop) and len(item.slides) > 1: if item.is_capable(ItemCapabilities.CanLoop) and len(item.slides) > 1:
@ -1013,9 +1012,9 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.theme_screen.setChecked(False) self.theme_screen.setChecked(False)
self.desktop_screen.setChecked(False) self.desktop_screen.setChecked(False)
if checked: if checked:
Settings().setValue(self.main_window.general_settings_section + '/screen blank', 'blanked') self.settings.setValue(self.main_window.general_settings_section + '/screen blank', 'blanked')
else: else:
Settings().remove(self.main_window.general_settings_section + '/screen blank') self.settings.remove(self.main_window.general_settings_section + '/screen blank')
self.blank_plugin() self.blank_plugin()
self.update_preview() self.update_preview()
self.on_toggle_loop() self.on_toggle_loop()
@ -1034,9 +1033,9 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.theme_screen.setChecked(checked) self.theme_screen.setChecked(checked)
self.desktop_screen.setChecked(False) self.desktop_screen.setChecked(False)
if checked: if checked:
Settings().setValue(self.main_window.general_settings_section + '/screen blank', 'themed') self.settings.setValue(self.main_window.general_settings_section + '/screen blank', 'themed')
else: else:
Settings().remove(self.main_window.general_settings_section + '/screen blank') self.settings.remove(self.main_window.general_settings_section + '/screen blank')
self.blank_plugin() self.blank_plugin()
self.update_preview() self.update_preview()
self.on_toggle_loop() self.on_toggle_loop()
@ -1056,9 +1055,9 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.theme_screen.setChecked(False) self.theme_screen.setChecked(False)
self.desktop_screen.setChecked(checked) self.desktop_screen.setChecked(checked)
if checked: if checked:
Settings().setValue(self.main_window.general_settings_section + '/screen blank', 'hidden') self.settings.setValue(self.main_window.general_settings_section + '/screen blank', 'hidden')
else: else:
Settings().remove(self.main_window.general_settings_section + '/screen blank') self.settings.remove(self.main_window.general_settings_section + '/screen blank')
self.hide_plugin(checked) self.hide_plugin(checked)
self.update_preview() self.update_preview()
self.on_toggle_loop() self.on_toggle_loop()
@ -1145,7 +1144,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
return return
# If "click live slide to unblank" is enabled, unblank the display. And start = Item is sent to Live. # If "click live slide to unblank" is enabled, unblank the display. And start = Item is sent to Live.
# Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost. # Note: If this if statement is placed at the bottom of this function instead of top slide transitions are lost.
if self.is_live and Settings().value('core/click live slide to unblank'): if self.is_live and self.settings.value('core/click live slide to unblank'):
if not start: if not start:
Registry().execute('slidecontroller_live_unblank') Registry().execute('slidecontroller_live_unblank')
row = self.preview_widget.current_slide_number() row = self.preview_widget.current_slide_number()
@ -1353,7 +1352,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.play_slides_once.setText(UiStrings().PlaySlidesToEnd) self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
self.play_slides_menu.setDefaultAction(self.play_slides_loop) self.play_slides_menu.setDefaultAction(self.play_slides_loop)
self.play_slides_once.setChecked(False) self.play_slides_once.setChecked(False)
if Settings().value('core/click live slide to unblank'): if self.settings.value('core/click live slide to unblank'):
Registry().execute('slidecontroller_live_unblank') Registry().execute('slidecontroller_live_unblank')
else: else:
self.play_slides_loop.setIcon(UiIcons().clock) self.play_slides_loop.setIcon(UiIcons().clock)
@ -1378,7 +1377,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop) self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
self.play_slides_menu.setDefaultAction(self.play_slides_once) self.play_slides_menu.setDefaultAction(self.play_slides_once)
self.play_slides_loop.setChecked(False) self.play_slides_loop.setChecked(False)
if Settings().value('core/click live slide to unblank'): if self.settings.value('core/click live slide to unblank'):
Registry().execute('slidecontroller_live_unblank') Registry().execute('slidecontroller_live_unblank')
else: else:
self.play_slides_once.setIcon(UiIcons().clock) self.play_slides_once.setIcon(UiIcons().clock)
@ -1423,7 +1422,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
Triggered when a preview slide item is double clicked Triggered when a preview slide item is double clicked
""" """
if self.service_item: if self.service_item:
if Settings().value('advanced/double click live') and Settings().value('core/auto unblank'): if self.settings.value('advanced/double click live') and self.settings.value('core/auto unblank'):
# Live and Preview have issues if we have video or presentations # Live and Preview have issues if we have video or presentations
# playing in both at the same time. # playing in both at the same time.
if self.service_item.is_command(): if self.service_item.is_command():

View File

@ -23,6 +23,7 @@ All the tests
""" """
import os import os
from tempfile import mkstemp from tempfile import mkstemp
from unittest.mock import MagicMock
import pytest import pytest
from PyQt5 import QtCore, QtWidgets from PyQt5 import QtCore, QtWidgets
@ -39,24 +40,34 @@ def qapp():
del app del app
@pytest.fixture
def registry():
"""An instance of the Registry"""
Registry.create()
@pytest.yield_fixture @pytest.yield_fixture
def settings(qapp): def settings(qapp, registry):
"""A Settings() instance""" """A Settings() instance"""
fd, ini_file = mkstemp('.ini') fd, ini_file = mkstemp('.ini')
Settings.set_filename(ini_file) Settings.set_filename(ini_file)
Registry.create()
Settings().setDefaultFormat(QtCore.QSettings.IniFormat) Settings().setDefaultFormat(QtCore.QSettings.IniFormat)
# Needed on windows to make sure a Settings object is available during the tests # Needed on windows to make sure a Settings object is available during the tests
sets = Settings() sets = Settings()
sets.setValue('themes/global theme', 'my_theme') sets.setValue('themes/global theme', 'my_theme')
Registry().register('settings', set) Registry().register('settings', sets)
yield sets yield sets
del sets del sets
os.close(fd) os.close(fd)
os.unlink(Settings().fileName()) os.unlink(Settings().fileName())
@pytest.fixture @pytest.yield_fixture
def registry(): def mock_settings(registry):
"""An instance of the Registry""" """A Mock Settings() instance"""
Registry.create() # Create and register a mock settings object to work with
mock_settings = MagicMock()
Registry().register('settings', mock_settings)
yield mock_settings
Registry().remove('settings')
del mock_settings

File diff suppressed because it is too large Load Diff