← Back to team overview

openlp-core team mailing list archive

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

 

Tomas Groth has proposed merging lp:~tomasgroth/openlp/appveyor-pytest into lp:openlp.

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

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/appveyor-pytest/+merge/364102
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/appveyor-pytest into lp:openlp.
=== 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 15:52:08 +0000
@@ -706,6 +706,7 @@
             else:
                 # The remaining elements do not fit, thus reset the indexes, create a new list and continue.
                 raw_list = raw_list[index + 1:]
+                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]

=== 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 15:52:08 +0000
@@ -32,13 +32,11 @@
 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 @@
         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 @@
         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 @@
         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()

=== 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 15:52:08 +0000
@@ -46,6 +46,7 @@
 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):

=== modified file 'scripts/appveyor.yml'
--- scripts/appveyor.yml	2018-10-30 19:46:55 +0000
+++ scripts/appveyor.yml	2019-03-07 15:52:08 +0000
@@ -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
@@ -7,15 +10,17 @@
   - mv BRANCHPATH openlp-branch
 
 environment:
-  PYTHON: C:\\Python37-x64
+  matrix:
+    - PYTHON: C:\\Python37-x64
+    - PYTHON: C:\\Python37
 
 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 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
-  - 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
@@ -27,7 +32,7 @@
 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..
 

=== 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 15:52:08 +0000
@@ -15,13 +15,12 @@
 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
 # more details.                                                               #
 #                                                                             #
-
-
+# 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
-# 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  #
 from unittest import TestCase
 from unittest.mock import MagicMock, patch
 
@@ -57,14 +56,15 @@
         # 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')

=== 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 15:52:08 +0000
@@ -324,7 +324,7 @@
         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):
         """

=== 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 15:52:08 +0000
@@ -24,7 +24,7 @@
 """
 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 @@
         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()]


Follow ups