← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~whydoubt/openlp/fix_core_tests into lp:openlp

 

Jeffrey Smith has proposed merging lp:~whydoubt/openlp/fix_core_tests into lp:openlp.

Requested reviews:
  Andreas Preikschat (googol)

For more details, see:
https://code.launchpad.net/~whydoubt/openlp/fix_core_tests/+merge/185080

Fix various tests and broken code revealed by tests.

For me this fixes about 7 failed tests.

This gets me down to 0 failures in 'interfaces'.

Combined with fixes from other proposals I have
submitted, this gets me down to 8 failures in 'functional'.
-- 
https://code.launchpad.net/~whydoubt/openlp/fix_core_tests/+merge/185080
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/starttimeform.py'
--- openlp/core/ui/starttimeform.py	2013-08-31 18:17:38 +0000
+++ openlp/core/ui/starttimeform.py	2013-09-11 15:13:50 +0000
@@ -88,9 +88,9 @@
         """
         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
 

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2013-08-31 18:17:38 +0000
+++ openlp/core/utils/__init__.py	2013-09-11 15:13:50 +0000
@@ -256,7 +256,7 @@
     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

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2013-08-31 18:17:38 +0000
+++ openlp/plugins/bibles/lib/http.py	2013-09-11 15:13:50 +0000
@@ -717,7 +717,7 @@
         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)

=== modified file 'tests/functional/openlp_core_lib/test_lib.py'
--- tests/functional/openlp_core_lib/test_lib.py	2013-08-31 18:17:38 +0000
+++ tests/functional/openlp_core_lib/test_lib.py	2013-09-11 15:13:50 +0000
@@ -187,7 +187,7 @@
         """
         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 @@
             # 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'

=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_http.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_http.py	2013-08-31 18:17:38 +0000
+++ tests/interfaces/openlp_plugins/bibles/test_lib_http.py	2013-09-11 15:13:50 +0000
@@ -43,7 +43,7 @@
         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 @@
         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'
 

=== modified file 'tests/interfaces/openlp_plugins/remotes/test_server.py'
--- tests/interfaces/openlp_plugins/remotes/test_server.py	2013-08-31 18:17:38 +0000
+++ tests/interfaces/openlp_plugins/remotes/test_server.py	2013-09-11 15:13:50 +0000
@@ -9,7 +9,7 @@
 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


Follow ups