Attempt to fix appveyor tests

This commit is contained in:
Tomas Groth 2019-02-14 22:19:26 +01:00
parent ff20f53618
commit b10aa24119
5 changed files with 20 additions and 13 deletions

View File

@ -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):

View File

@ -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..

View File

@ -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')

View File

@ -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):
"""

View File

@ -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()]