← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/catchupfrom221 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/catchupfrom221 into lp:openlp.

Requested reviews:
  Tomas Groth (tomasgroth)

For more details, see:
https://code.launchpad.net/~trb143/openlp/catchupfrom221/+merge/278261

Clone of fixes in 2.2.1 which are not in trunk.

lp:~trb143/openlp/catchupfrom221 (revision 2568)
[SUCCESS] https//ci.openlp.io/job/Branch-01-Pull/1181/
[SUCCESS] https//ci.openlp.io/job/Branch-02-Functional-Tests/1104/
[SUCCESS] https//ci.openlp.io/job/Branch-03-Interface-Tests/1045/
[SUCCESS] https//ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/892/
[SUCCESS] https//ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/488/
[SUCCESS] https//ci.openlp.io/job/Branch-05a-Code_Analysis/604/
[SUCCESS] https//ci.openlp.io/job/Branch-05b-Test_Coverage/475/
-- 
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2015-09-08 19:13:59 +0000
+++ openlp/plugins/bibles/lib/http.py	2015-11-22 14:08:30 +0000
@@ -27,7 +27,6 @@
 import socket
 import urllib.parse
 import urllib.error
-from html.parser import HTMLParseError
 
 from bs4 import BeautifulSoup, NavigableString, Tag
 
@@ -290,7 +289,7 @@
             page_source = str(page_source, 'cp1251')
         try:
             soup = BeautifulSoup(page_source)
-        except HTMLParseError:
+        except Exception:
             log.error('BeautifulSoup could not parse the Bible page.')
             send_error_message('parse')
             return None
@@ -762,7 +761,7 @@
     try:
         soup = BeautifulSoup(page_source)
         CLEANER_REGEX.sub('', str(soup))
-    except HTMLParseError:
+    except Exception:
         log.exception('BeautifulSoup could not parse the bible page.')
     if not soup:
         send_error_message('parse')

=== modified file 'openlp/plugins/songs/lib/songselect.py'
--- openlp/plugins/songs/lib/songselect.py	2015-07-04 21:09:59 +0000
+++ openlp/plugins/songs/lib/songselect.py	2015-11-22 14:08:30 +0000
@@ -23,11 +23,12 @@
 The :mod:`~openlp.plugins.songs.lib.songselect` module contains the SongSelect importer itself.
 """
 import logging
+import sys
 from http.cookiejar import CookieJar
 from urllib.parse import urlencode
 from urllib.request import HTTPCookieProcessor, URLError, build_opener
 from html.parser import HTMLParser
-
+from html import unescape
 
 from bs4 import BeautifulSoup, NavigableString
 
@@ -130,8 +131,8 @@
                 break
             for result in search_results:
                 song = {
-                    'title': self.html_parser.unescape(result.find('h3').string),
-                    'authors': [self.html_parser.unescape(author.string) for author in result.find_all('li')],
+                    'title': unescape(result.find('h3').string),
+                    'authors': [unescape(author.string) for author in result.find_all('li')],
                     'link': BASE_URL + result.find('a')['href']
                 }
                 if callback:
@@ -167,7 +168,7 @@
         if callback:
             callback()
         song['copyright'] = '/'.join([li.string for li in song_page.find('ul', 'copyright').find_all('li')])
-        song['copyright'] = self.html_parser.unescape(song['copyright'])
+        song['copyright'] = unescape(song['copyright'])
         song['ccli_number'] = song_page.find('ul', 'info').find('li').string.split(':')[1].strip()
         song['verses'] = []
         verses = lyrics_page.find('section', 'lyrics').find_all('p')
@@ -180,9 +181,9 @@
                 else:
                     verse['lyrics'] += '\n'
             verse['lyrics'] = verse['lyrics'].strip(' \n\r\t')
-            song['verses'].append(self.html_parser.unescape(verse))
+            song['verses'].append(unescape(verse))
         for counter, author in enumerate(song['authors']):
-            song['authors'][counter] = self.html_parser.unescape(author)
+            song['authors'][counter] = unescape(author)
         return song
 
     def save_song(self, song):

=== modified file 'tests/functional/openlp_core_ui_media/test_vlcplayer.py'
--- tests/functional/openlp_core_ui_media/test_vlcplayer.py	2015-05-25 20:58:05 +0000
+++ tests/functional/openlp_core_ui_media/test_vlcplayer.py	2015-11-22 14:08:30 +0000
@@ -25,7 +25,7 @@
 import os
 import sys
 from datetime import datetime, timedelta
-from unittest import TestCase
+from unittest import TestCase, skip
 
 from openlp.core.common import Registry
 from openlp.core.ui.media import MediaState, MediaType
@@ -50,6 +50,22 @@
             del sys.modules['openlp.core.ui.media.vendor.vlc']
         MockDateTime.revert()
 
+    @skip('No way to test this')
+    @patch('openlp.core.ui.media.vlcplayer.vlc')
+    def get_vlc_fails_and_removes_module_test(self, mocked_vlc):
+        """
+        Test that when the VLC import fails, it removes the module from sys.modules
+        """
+        # GIVEN: We're on OS X and we don't have the VLC plugin path set
+        mocked_vlc.Instance.side_effect = NameError
+        mocked_vlc.libvlc_get_version.return_value = b'0.0.0'
+
+        # WHEN: An checking if the player is available
+        get_vlc()
+
+        # THEN: The extra environment variable should be there
+        self.assertNotIn('openlp.core.ui.media.vendor.vlc', sys.modules)
+
     @patch('openlp.core.ui.media.vlcplayer.is_macosx')
     def fix_vlc_22_plugin_path_test(self, mocked_is_macosx):
         """
@@ -74,10 +90,6 @@
         """
         # GIVEN: We're not on OS X and we don't have the VLC plugin path set
         mocked_is_macosx.return_value = False
-        if 'VLC_PLUGIN_PATH' in os.environ:
-            del os.environ['VLC_PLUGIN_PATH']
-        if 'openlp.core.ui.media.vendor.vlc' in sys.modules:
-            del sys.modules['openlp.core.ui.media.vendor.vlc']
 
         # WHEN: An checking if the player is available
         get_vlc()


Follow ups