← Back to team overview

openlp-core team mailing list archive

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

 

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

Commit message:
Fixed foilpresenter song importer and its tests for Python3.

Requested reviews:
  OpenLP Core (openlp-core)

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

Fixed foilpresenter song importer and its tests for Python3.

On Fedora, tested with:
  nosetests-3.3 -v tests/functional/openlp_plugins/songs/test_foilpresenterimport.py
-- 
https://code.launchpad.net/~whydoubt/openlp/fix_foilimport_py3/+merge/184503
Your team OpenLP Core is requested to review the proposed merge of lp:~whydoubt/openlp/fix_foilimport_py3 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/foilpresenterimport.py'
--- openlp/plugins/songs/lib/foilpresenterimport.py	2013-08-31 18:17:38 +0000
+++ openlp/plugins/songs/lib/foilpresenterimport.py	2013-09-09 04:11:33 +0000
@@ -483,7 +483,7 @@
             temp_verse_order_backup.append(''.join((verse_type[0],
                 verse_number)))
             sxml.add_verse_to_lyrics(verse_type, verse_number, text)
-        song.lyrics = str(sxml.extract_xml(), 'utf-8')
+        song.lyrics = sxml.extract_xml().decode()
         # Process verse order
         verse_order = []
         verse_strophenr = []

=== modified file 'tests/functional/openlp_plugins/songs/test_foilpresenterimport.py'
--- tests/functional/openlp_plugins/songs/test_foilpresenterimport.py	2013-08-31 18:17:38 +0000
+++ tests/functional/openlp_plugins/songs/test_foilpresenterimport.py	2013-09-09 04:11:33 +0000
@@ -34,6 +34,8 @@
 from unittest import TestCase
 from mock import patch, MagicMock
 
+from lxml import objectify
+
 from openlp.plugins.songs.lib import VerseType
 from openlp.plugins.songs.lib.foilpresenterimport import FoilPresenter
 
@@ -182,7 +184,7 @@
         self.process_lyrics_patcher.stop()
         self.mocked_song_xml.reset()
         mock_foilpresenterfolie = MagicMock()
-        del mock_foilpresenterfolie.strophen.strophe
+        mock_foilpresenterfolie.strophen = MagicMock(spec=objectify.Element)
         mocked_song = MagicMock()
         foil_presenter_instance = FoilPresenter(self.mocked_manager, self.mocked_song_import)
 
@@ -192,4 +194,4 @@
         # THEN: _process_lyrics should return None and the song_import logError method should have been called once
         self.assertIsNone(result)
         self.mocked_song_import.logError.assert_called_once_with('Element Text', 'Translated String')
-        self.process_lyrics_patcher.start()
\ No newline at end of file
+        self.process_lyrics_patcher.start()


Follow ups