diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index 4fddb2a90..0a0867b3f 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -88,9 +88,9 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): """ Split time up into hours minutes and seconds from secongs """ - hours = seconds / 3600 + hours = seconds // 3600 seconds -= 3600 * hours - minutes = seconds / 60 + minutes = seconds // 60 seconds -= 60 * minutes return hours, minutes, seconds diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 3bd052a0e..d2e664e75 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -256,7 +256,7 @@ def is_not_image_file(file_name): if not file_name: return True else: - formats = [str(fmt).lower() for fmt in QtGui.QImageReader.supportedImageFormats()] + formats = [bytes(fmt).decode().lower() for fmt in QtGui.QImageReader.supportedImageFormats()] file_part, file_extension = os.path.splitext(str(file_name)) if file_extension[1:].lower() in formats and os.path.exists(file_name): return False diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 5d9e51c15..0fee09265 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -717,7 +717,7 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre return None page_source = page.read() if pre_parse_regex and pre_parse_substitute is not None: - page_source = re.sub(pre_parse_regex, pre_parse_substitute, page_source) + page_source = re.sub(pre_parse_regex, pre_parse_substitute, page_source.decode()) soup = None try: soup = BeautifulSoup(page_source) diff --git a/tests/functional/openlp_core_lib/test_lib.py b/tests/functional/openlp_core_lib/test_lib.py index a7d7d5d88..fa7fe92e9 100644 --- a/tests/functional/openlp_core_lib/test_lib.py +++ b/tests/functional/openlp_core_lib/test_lib.py @@ -187,7 +187,7 @@ class TestLib(TestCase): """ Test the get_text_file_string() method when a read error happens """ - with patch('openlp.core.lib.os.path.isfile') as mocked_isfile, patch('builtins.open') as mocked_open: + with patch('openlp.core.lib.os.path.isfile') as mocked_isfile, patch('openlp.core.lib.open', create=True) as mocked_open: # GIVEN: A mocked-out open() which raises an exception and isfile returns True filename = 'testfile.txt' mocked_isfile.return_value = True @@ -252,7 +252,7 @@ class TestLib(TestCase): # GIVEN: A set of mocked-out Qt classes mocked_byte_array = MagicMock() MockedQtCore.QByteArray.return_value = mocked_byte_array - mocked_byte_array.toBase64.return_value = 'base64mock' + mocked_byte_array.toBase64.return_value = QtCore.QByteArray('base64mock') mocked_buffer = MagicMock() MockedQtCore.QBuffer.return_value = mocked_buffer MockedQtCore.QIODevice.WriteOnly = 'writeonly' diff --git a/tests/functional/openlp_core_utils/test_utils.py b/tests/functional/openlp_core_utils/test_utils.py index 6eacb2e48..2aa1f9611 100644 --- a/tests/functional/openlp_core_utils/test_utils.py +++ b/tests/functional/openlp_core_utils/test_utils.py @@ -8,6 +8,8 @@ from mock import patch from openlp.core.utils import clean_filename, get_filesystem_encoding, _get_frozen_path, get_locale_key, \ get_natural_key, split_filename +import os + class TestUtils(TestCase): """ @@ -120,6 +122,8 @@ class TestUtils(TestCase): # THEN: We get a properly sorted list test_passes = sorted(unsorted_list, key=get_locale_key) == ['Aushang', '\u00C4u\u00DFerung', 'Auszug'] assert test_passes, 'Strings should be sorted properly' + if os.name != 'nt': + del get_locale_key_windows_test def get_locale_key_linux_test(self): diff --git a/tests/interfaces/openlp_plugins/bibles/test_lib_http.py b/tests/interfaces/openlp_plugins/bibles/test_lib_http.py index f760996b5..bd645f1ff 100644 --- a/tests/interfaces/openlp_plugins/bibles/test_lib_http.py +++ b/tests/interfaces/openlp_plugins/bibles/test_lib_http.py @@ -43,7 +43,7 @@ class TestBibleHTTP(TestCase): results = handler.get_bible_chapter('NIV', 'John', 3) # THEN: We should get back a valid service item - assert len(results.verselist) == 36, 'The book of John should not have had any verses added or removed' + assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed' def crosswalk_extract_books_test(self): """ @@ -69,5 +69,5 @@ class TestBibleHTTP(TestCase): results = handler.get_bible_chapter('niv', 'john', 3) # THEN: We should get back a valid service item - assert len(results.verselist) == 36, 'The book of John should not have had any verses added or removed' + assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed' diff --git a/tests/interfaces/openlp_plugins/remotes/test_server.py b/tests/interfaces/openlp_plugins/remotes/test_server.py index 63975370f..6cb44a933 100644 --- a/tests/interfaces/openlp_plugins/remotes/test_server.py +++ b/tests/interfaces/openlp_plugins/remotes/test_server.py @@ -9,7 +9,7 @@ from mock import MagicMock import urllib.request, urllib.error, urllib.parse import cherrypy -from BeautifulSoup import BeautifulSoup +from bs4 import BeautifulSoup from openlp.core.lib import Settings from openlp.plugins.remotes.lib.httpserver import HttpServer