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
1=== modified file 'openlp/core/display/render.py'
2--- openlp/core/display/render.py 2019-02-14 15:09:09 +0000
3+++ openlp/core/display/render.py 2019-03-07 19:30:28 +0000
4@@ -706,6 +706,7 @@
5 else:
6 # The remaining elements do not fit, thus reset the indexes, create a new list and continue.
7 raw_list = raw_list[index + 1:]
8+ log.debug(raw_list)
9 raw_list[0] = raw_tags + raw_list[0]
10 html_list = html_list[index + 1:]
11 html_list[0] = html_tags + html_list[0]
12
13=== modified file 'openlp/core/display/window.py'
14--- openlp/core/display/window.py 2019-02-14 15:09:09 +0000
15+++ openlp/core/display/window.py 2019-03-07 19:30:28 +0000
16@@ -29,16 +29,14 @@
17
18 from PyQt5 import QtCore, QtWebChannel, QtWidgets
19
20-from openlp.core.common.path import Path, path_to_str
21+from openlp.core.common.path import path_to_str
22 from openlp.core.common.settings import Settings
23 from openlp.core.common.registry import Registry
24+from openlp.core.common.applocation import AppLocation
25 from openlp.core.ui import HideMode
26 from openlp.core.display.screens import ScreenList
27
28 log = logging.getLogger(__name__)
29-DISPLAY_PATH = Path(__file__).parent / 'html' / 'display.html'
30-CHECKERBOARD_PATH = Path(__file__).parent / 'html' / 'checkerboard.png'
31-OPENLP_SPLASH_SCREEN_PATH = Path(__file__).parent / 'html' / 'openlp-splash-screen.png'
32
33
34 class MediaWatcher(QtCore.QObject):
35@@ -126,7 +124,11 @@
36 self.webview.page().setBackgroundColor(QtCore.Qt.transparent)
37 self.layout.addWidget(self.webview)
38 self.webview.loadFinished.connect(self.after_loaded)
39- self.set_url(QtCore.QUrl.fromLocalFile(path_to_str(DISPLAY_PATH)))
40+ display_base_path = AppLocation.get_directory(AppLocation.AppDir) / 'core' / 'display' / 'html'
41+ self.display_path = display_base_path / 'display.html'
42+ self.checkerboard_path = display_base_path / 'checkerboard.png'
43+ self.openlp_splash_screen_path = display_base_path / 'openlp-splash-screen.png'
44+ self.set_url(QtCore.QUrl.fromLocalFile(path_to_str(self.display_path)))
45 self.media_watcher = MediaWatcher(self)
46 self.channel = QtWebChannel.QWebChannel(self)
47 self.channel.registerObject('mediaWatcher', self.media_watcher)
48@@ -169,7 +171,7 @@
49 bg_color = Settings().value('core/logo background color')
50 image = Settings().value('core/logo file')
51 if path_to_str(image).startswith(':'):
52- image = OPENLP_SPLASH_SCREEN_PATH
53+ image = self.openlp_splash_screen_path
54 image_uri = image.as_uri()
55 self.run_javascript('Display.setStartupSplashScreen("{bg_color}", "{image}");'.format(bg_color=bg_color,
56 image=image_uri))
57@@ -329,7 +331,7 @@
58 if theme.background_type == 'transparent' and not self.is_display:
59 theme_copy = copy.deepcopy(theme)
60 theme_copy.background_type = 'image'
61- theme_copy.background_filename = CHECKERBOARD_PATH
62+ theme_copy.background_filename = self.checkerboard_path
63 exported_theme = theme_copy.export_theme()
64 else:
65 exported_theme = theme.export_theme()
66
67=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
68--- openlp/plugins/presentations/lib/impresscontroller.py 2019-02-14 15:09:09 +0000
69+++ openlp/plugins/presentations/lib/impresscontroller.py 2019-03-07 19:30:28 +0000
70@@ -46,6 +46,7 @@
71 if is_win():
72 from win32com.client import Dispatch
73 import pywintypes
74+ uno_available = False
75 # Declare an empty exception to match the exception imported from UNO
76
77 class ErrorCodeIOException(Exception):
78
79=== modified file 'scripts/appveyor.yml'
80--- scripts/appveyor.yml 2018-10-30 19:46:55 +0000
81+++ scripts/appveyor.yml 2019-03-07 19:30:28 +0000
82@@ -1,5 +1,8 @@
83 version: OpenLP-win-ci-b{build}
84
85+image:
86+ - Visual Studio 2017
87+
88 clone_script:
89 - curl -L https://bazaar.launchpad.net/BRANCHPATH/tarball -o sourcecode.tar.gz
90 - 7z e sourcecode.tar.gz
91@@ -7,15 +10,17 @@
92 - mv BRANCHPATH openlp-branch
93
94 environment:
95- PYTHON: C:\\Python37-x64
96+ matrix:
97+ - PYTHON: C:\\Python37-x64
98+ - PYTHON: C:\\Python37
99
100 install:
101 # Install dependencies from pypi
102- - "%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"
103+ - "%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"
104 # Download and unpack mupdf
105 - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip
106 - 7z x mupdf-1.14.0-windows.zip
107- - cp mupdf-1.14.0-windows/mupdf.exe openlp-branch/mupdf.exe
108+ - cp mupdf-1.14.0-windows/mutool.exe openlp-branch/mutool.exe
109 # Download and unpack mediainfo
110 - appveyor DownloadFile https://mediaarea.net/download/binary/mediainfo/18.08.1/MediaInfo_CLI_18.08.1_Windows_i386.zip
111 - mkdir MediaInfo
112@@ -27,7 +32,7 @@
113 test_script:
114 - cd openlp-branch
115 # Run the tests
116- - "%PYTHON%\\python.exe -m nose -v tests"
117+ - "%PYTHON%\\python.exe -m pytest -v tests"
118 # Go back to the user root folder
119 - cd..
120
121
122=== modified file 'tests/functional/openlp_core/api/test_deploy.py'
123--- tests/functional/openlp_core/api/test_deploy.py 2019-02-14 15:09:09 +0000
124+++ tests/functional/openlp_core/api/test_deploy.py 2019-03-07 19:30:28 +0000
125@@ -15,13 +15,12 @@
126 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
127 # more details. #
128 # #
129-
130-
131+# You should have received a copy of the GNU General Public License along #
132+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
133 # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
134 ###############################################################################
135+import os
136 from tempfile import mkdtemp
137-# You should have received a copy of the GNU General Public License along #
138-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
139 from unittest import TestCase
140 from unittest.mock import MagicMock, patch
141
142@@ -57,14 +56,15 @@
143 # GIVEN: A new downloaded zip file
144 mocked_zipfile = MagicMock()
145 MockZipFile.return_value = mocked_zipfile
146- root_path = Path('/tmp/remotes')
147+ root_path_str = '{sep}tmp{sep}remotes'.format(sep=os.sep)
148+ root_path = Path(root_path_str)
149
150 # WHEN: deploy_zipfile() is called
151 deploy_zipfile(root_path, 'site.zip')
152
153 # THEN: the zip file should have been extracted to the right location
154- MockZipFile.assert_called_once_with('/tmp/remotes/site.zip')
155- mocked_zipfile.extractall.assert_called_once_with('/tmp/remotes')
156+ MockZipFile.assert_called_once_with(root_path_str + os.sep + 'site.zip')
157+ mocked_zipfile.extractall.assert_called_once_with(root_path_str)
158
159 @patch('openlp.core.api.deploy.Registry')
160 @patch('openlp.core.api.deploy.get_web_page')
161
162=== modified file 'tests/functional/openlp_core/common/test_path.py'
163--- tests/functional/openlp_core/common/test_path.py 2019-02-14 15:09:09 +0000
164+++ tests/functional/openlp_core/common/test_path.py 2019-03-07 19:30:28 +0000
165@@ -324,7 +324,7 @@
166 obj = path.json_object(extra=1, args=2)
167
168 # THEN: A JSON decodable object should have been returned.
169- assert obj == {'__Path__': ('/', 'base', 'path', 'to', 'fi.le')}
170+ assert obj == {'__Path__': (os.sep, 'base', 'path', 'to', 'fi.le')}
171
172 def test_path_json_object_base_path(self):
173 """
174
175=== modified file 'tests/utils/test_bzr_tags.py'
176--- tests/utils/test_bzr_tags.py 2019-02-14 15:09:09 +0000
177+++ tests/utils/test_bzr_tags.py 2019-03-07 19:30:28 +0000
178@@ -24,7 +24,7 @@
179 """
180 import os
181 from subprocess import PIPE, Popen
182-from unittest import TestCase
183+from unittest import TestCase, SkipTest
184
185
186 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',
187@@ -42,7 +42,10 @@
188 path = os.path.dirname(__file__)
189
190 # WHEN getting the branches tags
191- bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
192+ try:
193+ bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
194+ except Exception:
195+ raise SkipTest('bzr is not installed')
196 std_out = bzr.communicate()[0]
197 count = len(TAGS1)
198 tags = [line.decode('utf-8').split()[0] for line in std_out.splitlines()]