From b10aa241199b51386baefac393f262167ca86285 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 14 Feb 2019 22:19:26 +0100 Subject: [PATCH 01/12] Attempt to fix appveyor tests --- .../presentations/lib/impresscontroller.py | 1 + scripts/appveyor.yml | 7 +++++-- tests/functional/openlp_core/api/test_deploy.py | 16 ++++++++-------- tests/functional/openlp_core/common/test_path.py | 2 +- tests/utils/test_bzr_tags.py | 7 +++++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index d231acb05..1db6b9e68 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -46,6 +46,7 @@ from openlp.plugins.presentations.lib.presentationcontroller import Presentation if is_win(): from win32com.client import Dispatch import pywintypes + uno_available = False # Declare an empty exception to match the exception imported from UNO class ErrorCodeIOException(Exception): diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 43f14e69d..3187a7b9f 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -1,5 +1,8 @@ version: OpenLP-win-ci-b{build} +image: + - Visual Studio 2017 + clone_script: - curl -L https://bazaar.launchpad.net/BRANCHPATH/tarball -o sourcecode.tar.gz - 7z e sourcecode.tar.gz @@ -11,7 +14,7 @@ environment: install: # Install dependencies from pypi - - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python nose mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 pymediainfo" + - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 pymediainfo" # Download and unpack mupdf - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip - 7z x mupdf-1.14.0-windows.zip @@ -27,7 +30,7 @@ build: off test_script: - cd openlp-branch # Run the tests - - "%PYTHON%\\python.exe -m nose -v tests" + - "%PYTHON%\\python.exe -m pytest -v tests" # Go back to the user root folder - cd.. diff --git a/tests/functional/openlp_core/api/test_deploy.py b/tests/functional/openlp_core/api/test_deploy.py index 784605034..75fc62cfb 100644 --- a/tests/functional/openlp_core/api/test_deploy.py +++ b/tests/functional/openlp_core/api/test_deploy.py @@ -15,13 +15,12 @@ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # more details. # # # - - -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### -from tempfile import mkdtemp # You should have received a copy of the GNU General Public License along # # with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +import os +from tempfile import mkdtemp from unittest import TestCase from unittest.mock import MagicMock, patch @@ -57,14 +56,15 @@ class TestRemoteDeploy(TestCase): # GIVEN: A new downloaded zip file mocked_zipfile = MagicMock() MockZipFile.return_value = mocked_zipfile - root_path = Path('/tmp/remotes') + root_path_str = '{sep}tmp{sep}remotes'.format(sep=os.sep) + root_path = Path(root_path_str) # WHEN: deploy_zipfile() is called deploy_zipfile(root_path, 'site.zip') # THEN: the zip file should have been extracted to the right location - MockZipFile.assert_called_once_with('/tmp/remotes/site.zip') - mocked_zipfile.extractall.assert_called_once_with('/tmp/remotes') + MockZipFile.assert_called_once_with(root_path_str + os.sep + 'site.zip') + mocked_zipfile.extractall.assert_called_once_with(root_path_str) @patch('openlp.core.api.deploy.Registry') @patch('openlp.core.api.deploy.get_web_page') diff --git a/tests/functional/openlp_core/common/test_path.py b/tests/functional/openlp_core/common/test_path.py index 7c0a34635..8695b58f1 100644 --- a/tests/functional/openlp_core/common/test_path.py +++ b/tests/functional/openlp_core/common/test_path.py @@ -324,7 +324,7 @@ class TestPath(TestCase): obj = path.json_object(extra=1, args=2) # THEN: A JSON decodable object should have been returned. - assert obj == {'__Path__': ('/', 'base', 'path', 'to', 'fi.le')} + assert obj == {'__Path__': (os.sep, 'base', 'path', 'to', 'fi.le')} def test_path_json_object_base_path(self): """ diff --git a/tests/utils/test_bzr_tags.py b/tests/utils/test_bzr_tags.py index e6c00f707..cd057ada4 100644 --- a/tests/utils/test_bzr_tags.py +++ b/tests/utils/test_bzr_tags.py @@ -24,7 +24,7 @@ Package to test for proper bzr tags. """ import os from subprocess import PIPE, Popen -from unittest import TestCase +from unittest import TestCase, SkipTest TAGS1 = {'1.9.0', '1.9.1', '1.9.2', '1.9.3', '1.9.4', '1.9.5', '1.9.6', '1.9.7', '1.9.8', '1.9.9', '1.9.10', @@ -42,7 +42,10 @@ class TestBzrTags(TestCase): path = os.path.dirname(__file__) # WHEN getting the branches tags - bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE) + try: + bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE) + except: + raise SkipTest('bzr is not installed') std_out = bzr.communicate()[0] count = len(TAGS1) tags = [line.decode('utf-8').split()[0] for line in std_out.splitlines()] From 7ec703a7d782eb6dca4c9df558d80a06930db0cf Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 21:25:37 +0100 Subject: [PATCH 02/12] try out appveyor changes --- scripts/appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 3187a7b9f..e441af41b 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -18,7 +18,7 @@ install: # Download and unpack mupdf - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip - 7z x mupdf-1.14.0-windows.zip - - cp mupdf-1.14.0-windows/mupdf.exe openlp-branch/mupdf.exe + - cp mupdf-1.14.0-windows/mutool.exe openlp-branch/mutool.exe # Download and unpack mediainfo - appveyor DownloadFile https://mediaarea.net/download/binary/mediainfo/18.08.1/MediaInfo_CLI_18.08.1_Windows_i386.zip - mkdir MediaInfo @@ -52,7 +52,8 @@ after_test: # - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe # - NSISPortable_3.0_English.paf.exe /S # Get the packaging code - - appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz + #- appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz + - appveyor DownloadFile http://bazaar.launchpad.net/~tomasgroth/openlp/packaging-webengine/tarball -FileName packaging.tar.gz - 7z e packaging.tar.gz - 7z x packaging.tar - mv ~openlp-core/openlp/packaging packaging From 85b40c50240dd1e3b019148f3a14b85ec4b0e244 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 21:33:18 +0100 Subject: [PATCH 03/12] another try --- scripts/appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index e441af41b..90473ebf7 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -56,7 +56,8 @@ after_test: - appveyor DownloadFile http://bazaar.launchpad.net/~tomasgroth/openlp/packaging-webengine/tarball -FileName packaging.tar.gz - 7z e packaging.tar.gz - 7z x packaging.tar - - mv ~openlp-core/openlp/packaging packaging + #- mv ~openlp-core/openlp/packaging packaging + - mv ~tomasgroth/openlp/packaging-webengine packaging # If this is trunk we should also build the manual - ps: >- If (BUILD_DOCS) { From 78263294c94c85029c3f178f21934b665700736d Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 22:50:52 +0100 Subject: [PATCH 04/12] debug print --- scripts/appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 90473ebf7..91b2edc68 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -70,7 +70,7 @@ after_test: &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update -c windows/config-appveyor.ini -b ../openlp-branch -d ../documentation --portable --tag-override TAG } else { cd packaging - &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable --tag-override TAG + &"$env:PYTHON\python.exe" builders/windows-builder.py -v --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable --tag-override TAG } artifacts: From 2ab8b8ebec0fe82469dbf30f739ca33d797fb8ae Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 16 Feb 2019 22:24:44 +0100 Subject: [PATCH 05/12] remove link to dev branch --- scripts/appveyor.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 91b2edc68..26c9987d8 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -52,12 +52,10 @@ after_test: # - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe # - NSISPortable_3.0_English.paf.exe /S # Get the packaging code - #- appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz - - appveyor DownloadFile http://bazaar.launchpad.net/~tomasgroth/openlp/packaging-webengine/tarball -FileName packaging.tar.gz + - appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz - 7z e packaging.tar.gz - 7z x packaging.tar - #- mv ~openlp-core/openlp/packaging packaging - - mv ~tomasgroth/openlp/packaging-webengine packaging + - mv ~openlp-core/openlp/packaging packaging # If this is trunk we should also build the manual - ps: >- If (BUILD_DOCS) { From 8de23cd980f6c1f6867ca542dd056ae9868e29a6 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sun, 17 Feb 2019 21:23:47 +0100 Subject: [PATCH 06/12] Also install webengine. --- scripts/appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 26c9987d8..c1e7a006d 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -14,7 +14,7 @@ environment: install: # Install dependencies from pypi - - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 pymediainfo" + - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo" # Download and unpack mupdf - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip - 7z x mupdf-1.14.0-windows.zip @@ -68,7 +68,7 @@ after_test: &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update -c windows/config-appveyor.ini -b ../openlp-branch -d ../documentation --portable --tag-override TAG } else { cd packaging - &"$env:PYTHON\python.exe" builders/windows-builder.py -v --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable --tag-override TAG + &"$env:PYTHON\python.exe" builders/windows-builder.py --skip-update --skip-translations -c windows/config-appveyor.ini -b ../openlp-branch --portable --tag-override TAG } artifacts: From d7b543ef526f49cb74f8275f571899fc67cc33c1 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sun, 17 Feb 2019 21:38:18 +0100 Subject: [PATCH 07/12] retry the test packaging branch --- scripts/appveyor.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index c1e7a006d..5e8cf172d 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -52,10 +52,12 @@ after_test: # - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe # - NSISPortable_3.0_English.paf.exe /S # Get the packaging code - - appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz + #- appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz + - appveyor DownloadFile http://bazaar.launchpad.net/~tomasgroth/openlp/packaging-webengine/tarball -FileName packaging.tar.gz - 7z e packaging.tar.gz - 7z x packaging.tar - - mv ~openlp-core/openlp/packaging packaging + #- mv ~openlp-core/openlp/packaging packaging + - mv ~tomasgroth/openlp/packaging-webengine packaging # If this is trunk we should also build the manual - ps: >- If (BUILD_DOCS) { From 0d6607087953f55be3e6fdfe633740423654b696 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 19 Feb 2019 21:46:31 +0100 Subject: [PATCH 08/12] build both 32 and 64 bit, and add debug print --- openlp/core/display/render.py | 1 + scripts/appveyor.yml | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index 35f144ee8..acd2334c4 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -706,6 +706,7 @@ class Renderer(RegistryBase, LogMixin, RegistryProperties, DisplayWindow): else: # The remaining elements do not fit, thus reset the indexes, create a new list and continue. raw_list = raw_list[index + 1:] + print(raw_list) raw_list[0] = raw_tags + raw_list[0] html_list = html_list[index + 1:] html_list[0] = html_tags + html_list[0] diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 5e8cf172d..9410159c8 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -10,7 +10,9 @@ clone_script: - mv BRANCHPATH openlp-branch environment: - PYTHON: C:\\Python37-x64 + matrix: + - PYTHON: C:\\Python37-x64 + - PYTHON: C:\\Python37 install: # Install dependencies from pypi From c241b28039cb2c1c985b1f84ed046cd560e12352 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 19 Feb 2019 22:38:44 +0100 Subject: [PATCH 09/12] put debug in the log --- openlp/core/display/render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index acd2334c4..06ce89283 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -706,7 +706,7 @@ class Renderer(RegistryBase, LogMixin, RegistryProperties, DisplayWindow): else: # The remaining elements do not fit, thus reset the indexes, create a new list and continue. raw_list = raw_list[index + 1:] - print(raw_list) + log.debug(raw_list) raw_list[0] = raw_tags + raw_list[0] html_list = html_list[index + 1:] html_list[0] = html_tags + html_list[0] From fb02d06a093230c9b5e30d0bea7abfaaf377abe1 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 27 Feb 2019 21:17:00 +0100 Subject: [PATCH 10/12] make the path of display web file work on frozen apps --- openlp/core/display/window.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index d811de5b2..c0ef2a1ef 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -32,13 +32,11 @@ from PyQt5 import QtCore, QtWebChannel, QtWidgets from openlp.core.common.path import Path, path_to_str from openlp.core.common.settings import Settings from openlp.core.common.registry import Registry +from openlp.core.common.applocation import AppLocation from openlp.core.ui import HideMode from openlp.core.display.screens import ScreenList log = logging.getLogger(__name__) -DISPLAY_PATH = Path(__file__).parent / 'html' / 'display.html' -CHECKERBOARD_PATH = Path(__file__).parent / 'html' / 'checkerboard.png' -OPENLP_SPLASH_SCREEN_PATH = Path(__file__).parent / 'html' / 'openlp-splash-screen.png' class MediaWatcher(QtCore.QObject): @@ -126,7 +124,11 @@ class DisplayWindow(QtWidgets.QWidget): self.webview.page().setBackgroundColor(QtCore.Qt.transparent) self.layout.addWidget(self.webview) self.webview.loadFinished.connect(self.after_loaded) - self.set_url(QtCore.QUrl.fromLocalFile(path_to_str(DISPLAY_PATH))) + display_base_path = AppLocation.get_directory(AppLocation.AppDir) / 'core' / 'display' / 'html' + self.display_path = display_base_path / 'display.html' + self.checkerboard_path = display_base_path / 'checkerboard.png' + self.openlp_splash_screen_path = display_base_path / 'openlp-splash-screen.png' + self.set_url(QtCore.QUrl.fromLocalFile(path_to_str(self.display_path))) self.media_watcher = MediaWatcher(self) self.channel = QtWebChannel.QWebChannel(self) self.channel.registerObject('mediaWatcher', self.media_watcher) @@ -169,7 +171,7 @@ class DisplayWindow(QtWidgets.QWidget): bg_color = Settings().value('core/logo background color') image = Settings().value('core/logo file') if path_to_str(image).startswith(':'): - image = OPENLP_SPLASH_SCREEN_PATH + image = self.openlp_splash_screen_path image_uri = image.as_uri() self.run_javascript('Display.setStartupSplashScreen("{bg_color}", "{image}");'.format(bg_color=bg_color, image=image_uri)) @@ -329,7 +331,7 @@ class DisplayWindow(QtWidgets.QWidget): if theme.background_type == 'transparent' and not self.is_display: theme_copy = copy.deepcopy(theme) theme_copy.background_type = 'image' - theme_copy.background_filename = CHECKERBOARD_PATH + theme_copy.background_filename = self.checkerboard_path exported_theme = theme_copy.export_theme() else: exported_theme = theme.export_theme() From fd502f80dc3e8a2a77694c91e9d00b8d3845f662 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 4 Mar 2019 21:32:05 +0100 Subject: [PATCH 11/12] Use the normal packaging repo --- scripts/appveyor.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/appveyor.yml b/scripts/appveyor.yml index 9410159c8..fd9ffac73 100644 --- a/scripts/appveyor.yml +++ b/scripts/appveyor.yml @@ -54,12 +54,10 @@ after_test: # - curl -L -O http://downloads.sourceforge.net/project/portableapps/NSIS%20Portable/NSISPortable_3.0_English.paf.exe # - NSISPortable_3.0_English.paf.exe /S # Get the packaging code - #- appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz - - appveyor DownloadFile http://bazaar.launchpad.net/~tomasgroth/openlp/packaging-webengine/tarball -FileName packaging.tar.gz + - appveyor DownloadFile http://bazaar.launchpad.net/~openlp-core/openlp/packaging/tarball -FileName packaging.tar.gz - 7z e packaging.tar.gz - 7z x packaging.tar - #- mv ~openlp-core/openlp/packaging packaging - - mv ~tomasgroth/openlp/packaging-webengine packaging + - mv ~openlp-core/openlp/packaging packaging # If this is trunk we should also build the manual - ps: >- If (BUILD_DOCS) { From b6a36f2324db7ae07a95ff52d6e5b60a50e94840 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 7 Mar 2019 20:23:04 +0100 Subject: [PATCH 12/12] pep8 fixes --- openlp/core/display/window.py | 2 +- tests/utils/test_bzr_tags.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index c0ef2a1ef..35442b5ed 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -29,7 +29,7 @@ import copy from PyQt5 import QtCore, QtWebChannel, QtWidgets -from openlp.core.common.path import Path, path_to_str +from openlp.core.common.path import path_to_str from openlp.core.common.settings import Settings from openlp.core.common.registry import Registry from openlp.core.common.applocation import AppLocation diff --git a/tests/utils/test_bzr_tags.py b/tests/utils/test_bzr_tags.py index cd057ada4..66b159c96 100644 --- a/tests/utils/test_bzr_tags.py +++ b/tests/utils/test_bzr_tags.py @@ -44,7 +44,7 @@ class TestBzrTags(TestCase): # WHEN getting the branches tags try: bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE) - except: + except Exception: raise SkipTest('bzr is not installed') std_out = bzr.communicate()[0] count = len(TAGS1)