Merge lp:~tomasgroth/openlp/appveyor-pytest into lp:openlp

Proposed by Tomas Groth
Status: Merged
Approved by: Raoul Snyman
Approved revision: 2858
Merged at revision: 2848
Proposed branch: lp:~tomasgroth/openlp/appveyor-pytest
Merge into: lp:openlp
Diff against target: 198 lines (+33/-21)
7 files modified
openlp/core/display/render.py (+1/-0)
openlp/core/display/window.py (+9/-7)
openlp/plugins/presentations/lib/impresscontroller.py (+1/-0)
scripts/appveyor.yml (+9/-4)
tests/functional/openlp_core/api/test_deploy.py (+7/-7)
tests/functional/openlp_core/common/test_path.py (+1/-1)
tests/utils/test_bzr_tags.py (+5/-2)
To merge this branch: bzr merge lp:~tomasgroth/openlp/appveyor-pytest
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Phill Approve
Review via email: mp+364116@code.launchpad.net

This proposal supersedes a proposal from 2019-03-07.

Commit message

Update the appveyor build script. Fix various bugs that caused the frozen app from working.

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Linting failed, please see https://ci.openlp.io/job/MP-03-Linting/44/ for more details

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linting passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

macOS tests passed!

Revision history for this message
Phill (phill-ridout) :
review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/display/render.py'
--- openlp/core/display/render.py 2019-02-14 15:09:09 +0000
+++ openlp/core/display/render.py 2019-03-07 19:30:28 +0000
@@ -706,6 +706,7 @@
706 else:706 else:
707 # The remaining elements do not fit, thus reset the indexes, create a new list and continue.707 # The remaining elements do not fit, thus reset the indexes, create a new list and continue.
708 raw_list = raw_list[index + 1:]708 raw_list = raw_list[index + 1:]
709 log.debug(raw_list)
709 raw_list[0] = raw_tags + raw_list[0]710 raw_list[0] = raw_tags + raw_list[0]
710 html_list = html_list[index + 1:]711 html_list = html_list[index + 1:]
711 html_list[0] = html_tags + html_list[0]712 html_list[0] = html_tags + html_list[0]
712713
=== modified file 'openlp/core/display/window.py'
--- openlp/core/display/window.py 2019-02-14 15:09:09 +0000
+++ openlp/core/display/window.py 2019-03-07 19:30:28 +0000
@@ -29,16 +29,14 @@
2929
30from PyQt5 import QtCore, QtWebChannel, QtWidgets30from PyQt5 import QtCore, QtWebChannel, QtWidgets
3131
32from openlp.core.common.path import Path, path_to_str32from openlp.core.common.path import path_to_str
33from openlp.core.common.settings import Settings33from openlp.core.common.settings import Settings
34from openlp.core.common.registry import Registry34from openlp.core.common.registry import Registry
35from openlp.core.common.applocation import AppLocation
35from openlp.core.ui import HideMode36from openlp.core.ui import HideMode
36from openlp.core.display.screens import ScreenList37from openlp.core.display.screens import ScreenList
3738
38log = logging.getLogger(__name__)39log = logging.getLogger(__name__)
39DISPLAY_PATH = Path(__file__).parent / 'html' / 'display.html'
40CHECKERBOARD_PATH = Path(__file__).parent / 'html' / 'checkerboard.png'
41OPENLP_SPLASH_SCREEN_PATH = Path(__file__).parent / 'html' / 'openlp-splash-screen.png'
4240
4341
44class MediaWatcher(QtCore.QObject):42class MediaWatcher(QtCore.QObject):
@@ -126,7 +124,11 @@
126 self.webview.page().setBackgroundColor(QtCore.Qt.transparent)124 self.webview.page().setBackgroundColor(QtCore.Qt.transparent)
127 self.layout.addWidget(self.webview)125 self.layout.addWidget(self.webview)
128 self.webview.loadFinished.connect(self.after_loaded)126 self.webview.loadFinished.connect(self.after_loaded)
129 self.set_url(QtCore.QUrl.fromLocalFile(path_to_str(DISPLAY_PATH)))127 display_base_path = AppLocation.get_directory(AppLocation.AppDir) / 'core' / 'display' / 'html'
128 self.display_path = display_base_path / 'display.html'
129 self.checkerboard_path = display_base_path / 'checkerboard.png'
130 self.openlp_splash_screen_path = display_base_path / 'openlp-splash-screen.png'
131 self.set_url(QtCore.QUrl.fromLocalFile(path_to_str(self.display_path)))
130 self.media_watcher = MediaWatcher(self)132 self.media_watcher = MediaWatcher(self)
131 self.channel = QtWebChannel.QWebChannel(self)133 self.channel = QtWebChannel.QWebChannel(self)
132 self.channel.registerObject('mediaWatcher', self.media_watcher)134 self.channel.registerObject('mediaWatcher', self.media_watcher)
@@ -169,7 +171,7 @@
169 bg_color = Settings().value('core/logo background color')171 bg_color = Settings().value('core/logo background color')
170 image = Settings().value('core/logo file')172 image = Settings().value('core/logo file')
171 if path_to_str(image).startswith(':'):173 if path_to_str(image).startswith(':'):
172 image = OPENLP_SPLASH_SCREEN_PATH174 image = self.openlp_splash_screen_path
173 image_uri = image.as_uri()175 image_uri = image.as_uri()
174 self.run_javascript('Display.setStartupSplashScreen("{bg_color}", "{image}");'.format(bg_color=bg_color,176 self.run_javascript('Display.setStartupSplashScreen("{bg_color}", "{image}");'.format(bg_color=bg_color,
175 image=image_uri))177 image=image_uri))
@@ -329,7 +331,7 @@
329 if theme.background_type == 'transparent' and not self.is_display:331 if theme.background_type == 'transparent' and not self.is_display:
330 theme_copy = copy.deepcopy(theme)332 theme_copy = copy.deepcopy(theme)
331 theme_copy.background_type = 'image'333 theme_copy.background_type = 'image'
332 theme_copy.background_filename = CHECKERBOARD_PATH334 theme_copy.background_filename = self.checkerboard_path
333 exported_theme = theme_copy.export_theme()335 exported_theme = theme_copy.export_theme()
334 else:336 else:
335 exported_theme = theme.export_theme()337 exported_theme = theme.export_theme()
336338
=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py 2019-02-14 15:09:09 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py 2019-03-07 19:30:28 +0000
@@ -46,6 +46,7 @@
46if is_win():46if is_win():
47 from win32com.client import Dispatch47 from win32com.client import Dispatch
48 import pywintypes48 import pywintypes
49 uno_available = False
49 # Declare an empty exception to match the exception imported from UNO50 # Declare an empty exception to match the exception imported from UNO
5051
51 class ErrorCodeIOException(Exception):52 class ErrorCodeIOException(Exception):
5253
=== modified file 'scripts/appveyor.yml'
--- scripts/appveyor.yml 2018-10-30 19:46:55 +0000
+++ scripts/appveyor.yml 2019-03-07 19:30:28 +0000
@@ -1,5 +1,8 @@
1version: OpenLP-win-ci-b{build}1version: OpenLP-win-ci-b{build}
22
3image:
4 - Visual Studio 2017
5
3clone_script:6clone_script:
4 - curl -L https://bazaar.launchpad.net/BRANCHPATH/tarball -o sourcecode.tar.gz7 - curl -L https://bazaar.launchpad.net/BRANCHPATH/tarball -o sourcecode.tar.gz
5 - 7z e sourcecode.tar.gz8 - 7z e sourcecode.tar.gz
@@ -7,15 +10,17 @@
7 - mv BRANCHPATH openlp-branch10 - mv BRANCHPATH openlp-branch
811
9environment:12environment:
10 PYTHON: C:\\Python37-x6413 matrix:
14 - PYTHON: C:\\Python37-x64
15 - PYTHON: C:\\Python37
1116
12install:17install:
13 # Install dependencies from pypi18 # Install dependencies from pypi
14 - "%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"19 - "%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"
15 # Download and unpack mupdf20 # Download and unpack mupdf
16 - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip21 - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip
17 - 7z x mupdf-1.14.0-windows.zip22 - 7z x mupdf-1.14.0-windows.zip
18 - cp mupdf-1.14.0-windows/mupdf.exe openlp-branch/mupdf.exe23 - cp mupdf-1.14.0-windows/mutool.exe openlp-branch/mutool.exe
19 # Download and unpack mediainfo24 # Download and unpack mediainfo
20 - appveyor DownloadFile https://mediaarea.net/download/binary/mediainfo/18.08.1/MediaInfo_CLI_18.08.1_Windows_i386.zip25 - appveyor DownloadFile https://mediaarea.net/download/binary/mediainfo/18.08.1/MediaInfo_CLI_18.08.1_Windows_i386.zip
21 - mkdir MediaInfo26 - mkdir MediaInfo
@@ -27,7 +32,7 @@
27test_script:32test_script:
28 - cd openlp-branch33 - cd openlp-branch
29 # Run the tests34 # Run the tests
30 - "%PYTHON%\\python.exe -m nose -v tests"35 - "%PYTHON%\\python.exe -m pytest -v tests"
31 # Go back to the user root folder36 # Go back to the user root folder
32 - cd..37 - cd..
3338
3439
=== modified file 'tests/functional/openlp_core/api/test_deploy.py'
--- tests/functional/openlp_core/api/test_deploy.py 2019-02-14 15:09:09 +0000
+++ tests/functional/openlp_core/api/test_deploy.py 2019-03-07 19:30:28 +0000
@@ -15,13 +15,12 @@
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
16# more details. #16# more details. #
17# #17# #
1818# You should have received a copy of the GNU General Public License along #
1919# with this program; if not, write to the Free Software Foundation, Inc., 59 #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21###############################################################################21###############################################################################
22import os
22from tempfile import mkdtemp23from tempfile import mkdtemp
23# You should have received a copy of the GNU General Public License along #
24# with this program; if not, write to the Free Software Foundation, Inc., 59 #
25from unittest import TestCase24from unittest import TestCase
26from unittest.mock import MagicMock, patch25from unittest.mock import MagicMock, patch
2726
@@ -57,14 +56,15 @@
57 # GIVEN: A new downloaded zip file56 # GIVEN: A new downloaded zip file
58 mocked_zipfile = MagicMock()57 mocked_zipfile = MagicMock()
59 MockZipFile.return_value = mocked_zipfile58 MockZipFile.return_value = mocked_zipfile
60 root_path = Path('/tmp/remotes')59 root_path_str = '{sep}tmp{sep}remotes'.format(sep=os.sep)
60 root_path = Path(root_path_str)
6161
62 # WHEN: deploy_zipfile() is called62 # WHEN: deploy_zipfile() is called
63 deploy_zipfile(root_path, 'site.zip')63 deploy_zipfile(root_path, 'site.zip')
6464
65 # THEN: the zip file should have been extracted to the right location65 # THEN: the zip file should have been extracted to the right location
66 MockZipFile.assert_called_once_with('/tmp/remotes/site.zip')66 MockZipFile.assert_called_once_with(root_path_str + os.sep + 'site.zip')
67 mocked_zipfile.extractall.assert_called_once_with('/tmp/remotes')67 mocked_zipfile.extractall.assert_called_once_with(root_path_str)
6868
69 @patch('openlp.core.api.deploy.Registry')69 @patch('openlp.core.api.deploy.Registry')
70 @patch('openlp.core.api.deploy.get_web_page')70 @patch('openlp.core.api.deploy.get_web_page')
7171
=== modified file 'tests/functional/openlp_core/common/test_path.py'
--- tests/functional/openlp_core/common/test_path.py 2019-02-14 15:09:09 +0000
+++ tests/functional/openlp_core/common/test_path.py 2019-03-07 19:30:28 +0000
@@ -324,7 +324,7 @@
324 obj = path.json_object(extra=1, args=2)324 obj = path.json_object(extra=1, args=2)
325325
326 # THEN: A JSON decodable object should have been returned.326 # THEN: A JSON decodable object should have been returned.
327 assert obj == {'__Path__': ('/', 'base', 'path', 'to', 'fi.le')}327 assert obj == {'__Path__': (os.sep, 'base', 'path', 'to', 'fi.le')}
328328
329 def test_path_json_object_base_path(self):329 def test_path_json_object_base_path(self):
330 """330 """
331331
=== modified file 'tests/utils/test_bzr_tags.py'
--- tests/utils/test_bzr_tags.py 2019-02-14 15:09:09 +0000
+++ tests/utils/test_bzr_tags.py 2019-03-07 19:30:28 +0000
@@ -24,7 +24,7 @@
24"""24"""
25import os25import os
26from subprocess import PIPE, Popen26from subprocess import PIPE, Popen
27from unittest import TestCase27from unittest import TestCase, SkipTest
2828
2929
30TAGS1 = {'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',30TAGS1 = {'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 @@
42 path = os.path.dirname(__file__)42 path = os.path.dirname(__file__)
4343
44 # WHEN getting the branches tags44 # WHEN getting the branches tags
45 bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)45 try:
46 bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
47 except Exception:
48 raise SkipTest('bzr is not installed')
46 std_out = bzr.communicate()[0]49 std_out = bzr.communicate()[0]
47 count = len(TAGS1)50 count = len(TAGS1)
48 tags = [line.decode('utf-8').split()[0] for line in std_out.splitlines()]51 tags = [line.decode('utf-8').split()[0] for line in std_out.splitlines()]