← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/super-fixes into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/super-fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/super-fixes/+merge/213362

Fixes for inheritance in the song importers. This should make the tests pass in Python 3.4.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/super-fixes/+merge/213362
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/super-fixes into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/easyslidesimport.py'
--- openlp/plugins/songs/lib/easyslidesimport.py	2014-03-08 19:58:58 +0000
+++ openlp/plugins/songs/lib/easyslidesimport.py	2014-03-29 15:02:26 +0000
@@ -49,7 +49,7 @@
         """
         Initialise the class.
         """
-        SongImport.__init__(self, manager, **kwargs)
+        super(EasySlidesImport, self).__init__(manager, **kwargs)
 
     def do_import(self):
         log.info('Importing EasySlides XML file %s', self.import_source)

=== modified file 'openlp/plugins/songs/lib/ewimport.py'
--- openlp/plugins/songs/lib/ewimport.py	2014-03-06 20:56:31 +0000
+++ openlp/plugins/songs/lib/ewimport.py	2014-03-29 15:02:26 +0000
@@ -73,7 +73,7 @@
     ability to import EasyWorship song files.
     """
     def __init__(self, manager, **kwargs):
-        SongImport.__init__(self, manager, **kwargs)
+        super(EasyWorshipSongImport, self).__init__(manager, **kwargs)
 
     def do_import(self):
         """

=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py	2014-03-08 19:58:58 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py	2014-03-29 15:02:26 +0000
@@ -97,7 +97,7 @@
         """
         Initialise the Song Beamer importer.
         """
-        SongImport.__init__(self, manager, **kwargs)
+        super(SongBeamerImport, self).__init__(manager, **kwargs)
 
     def do_import(self):
         """

=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py	2014-03-21 21:38:08 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py	2014-03-29 15:02:26 +0000
@@ -92,7 +92,7 @@
         """
         Initialise the SongShow Plus importer.
         """
-        SongImport.__init__(self, manager, **kwargs)
+        super(SongShowPlusImport, self).__init__(manager, **kwargs)
 
     def do_import(self):
         """

=== modified file 'tests/functional/openlp_plugins/songs/test_ewimport.py'
--- tests/functional/openlp_plugins/songs/test_ewimport.py	2014-03-06 20:40:08 +0000
+++ tests/functional/openlp_plugins/songs/test_ewimport.py	2014-03-29 15:02:26 +0000
@@ -77,7 +77,7 @@
     _title_assignment_list = []
 
     def __init__(self, manager):
-        EasyWorshipSongImport.__init__(self, manager)
+        EasyWorshipSongImport.__init__(self, manager, filenames=[])
 
     @property
     def title(self):
@@ -147,7 +147,7 @@
             mocked_manager = MagicMock()
 
             # WHEN: An importer object is created
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
 
             # THEN: The importer object should not be None
             self.assertIsNotNone(importer, 'Import should not be none')
@@ -159,7 +159,7 @@
         # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions.
         with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             importer.field_descriptions = TEST_FIELD_DESCS
 
             # WHEN: Called with a field name that exists
@@ -177,7 +177,7 @@
         # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions
         with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             importer.field_descriptions = TEST_FIELD_DESCS
 
             # WHEN: Called with a field name that does not exist
@@ -196,7 +196,7 @@
         with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
             patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
 
             # WHEN: set_record_struct is called with a list of field descriptions
             return_value = importer.set_record_struct(TEST_FIELD_DESCS)
@@ -213,7 +213,7 @@
         # GIVEN: A mocked out SongImport class, a mocked out "manager", an encoding and some test data and known results
         with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             importer.encoding = TEST_DATA_ENCODING
             importer.fields = TEST_FIELDS
             importer.field_descriptions = TEST_FIELD_DESCS
@@ -236,7 +236,7 @@
             with patch('openlp.plugins.songs.lib.ewimport.SongImport'):
                 mocked_manager = MagicMock()
                 mocked_memo_file = MagicMock()
-                importer = EasyWorshipSongImport(mocked_manager)
+                importer = EasyWorshipSongImport(mocked_manager, filenames=[])
                 importer.memo_file = mocked_memo_file
                 importer.encoding = TEST_DATA_ENCODING
 
@@ -267,7 +267,7 @@
         with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
             patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             mocked_os_path.isfile.side_effect = [True, False]
 
             # WHEN: Supplied with an import source
@@ -286,7 +286,7 @@
         with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
             patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             mocked_os_path.isfile.return_value = True
             importer.import_source = 'Songs.DB'
 
@@ -307,7 +307,7 @@
             patch('builtins.open') as mocked_open, \
             patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             mocked_os_path.isfile.return_value = True
             mocked_os_path.getsize.return_value = 0x800
             importer.import_source = 'Songs.DB'
@@ -334,7 +334,7 @@
             patch('builtins.open'), patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct, \
             patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as mocked_retrieve_windows_encoding:
             mocked_manager = MagicMock()
-            importer = EasyWorshipSongImport(mocked_manager)
+            importer = EasyWorshipSongImport(mocked_manager, filenames=[])
             mocked_os_path.isfile.return_value = True
             mocked_os_path.getsize.return_value = 0x800
             importer.import_source = 'Songs.DB'

=== modified file 'tests/functional/openlp_plugins/songs/test_songbeamerimport.py'
--- tests/functional/openlp_plugins/songs/test_songbeamerimport.py	2014-03-11 20:17:18 +0000
+++ tests/functional/openlp_plugins/songs/test_songbeamerimport.py	2014-03-29 15:02:26 +0000
@@ -66,7 +66,7 @@
             mocked_manager = MagicMock()
 
             # WHEN: An importer object is created
-            importer = SongBeamerImport(mocked_manager)
+            importer = SongBeamerImport(mocked_manager, filenames=[])
 
             # THEN: The importer object should not be None
             self.assertIsNotNone(importer, 'Import should not be none')
@@ -79,7 +79,7 @@
         with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
             mocked_manager = MagicMock()
             mocked_import_wizard = MagicMock()
-            importer = SongBeamerImport(mocked_manager)
+            importer = SongBeamerImport(mocked_manager, filenames=[])
             importer.import_wizard = mocked_import_wizard
             importer.stop_import_flag = True
 
@@ -100,7 +100,7 @@
         with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
             mocked_manager = MagicMock()
             mocked_import_wizard = MagicMock()
-            importer = SongBeamerImport(mocked_manager)
+            importer = SongBeamerImport(mocked_manager, filenames=[])
             importer.import_wizard = mocked_import_wizard
             importer.stop_import_flag = True
 
@@ -127,7 +127,7 @@
                 mocked_add_verse = MagicMock()
                 mocked_finish = MagicMock()
                 mocked_finish.return_value = True
-                importer = SongBeamerImport(mocked_manager)
+                importer = SongBeamerImport(mocked_manager, filenames=[])
                 importer.import_wizard = mocked_import_wizard
                 importer.stop_import_flag = False
                 importer.add_verse = mocked_add_verse

=== modified file 'tests/functional/openlp_plugins/songs/test_songshowplusimport.py'
--- tests/functional/openlp_plugins/songs/test_songshowplusimport.py	2014-03-11 20:17:18 +0000
+++ tests/functional/openlp_plugins/songs/test_songshowplusimport.py	2014-03-29 15:02:26 +0000
@@ -72,7 +72,7 @@
             mocked_manager = MagicMock()
 
             # WHEN: An importer object is created
-            importer = SongShowPlusImport(mocked_manager)
+            importer = SongShowPlusImport(mocked_manager, filenames=[])
 
             # THEN: The importer object should not be None
             self.assertIsNotNone(importer, 'Import should not be none')
@@ -85,7 +85,7 @@
         with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
             mocked_manager = MagicMock()
             mocked_import_wizard = MagicMock()
-            importer = SongShowPlusImport(mocked_manager)
+            importer = SongShowPlusImport(mocked_manager, filenames=[])
             importer.import_wizard = mocked_import_wizard
             importer.stop_import_flag = True
 
@@ -106,7 +106,7 @@
         with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
             mocked_manager = MagicMock()
             mocked_import_wizard = MagicMock()
-            importer = SongShowPlusImport(mocked_manager)
+            importer = SongShowPlusImport(mocked_manager, filenames=[])
             importer.import_wizard = mocked_import_wizard
             importer.stop_import_flag = True
 
@@ -126,7 +126,7 @@
         # GIVEN: A mocked out SongImport class, and a mocked out "manager"
         with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
             mocked_manager = MagicMock()
-            importer = SongShowPlusImport(mocked_manager)
+            importer = SongShowPlusImport(mocked_manager, filenames=[])
 
             # WHEN: Supplied with the following arguments replicating verses being added
             test_values = [('Verse 1', VerseType.tags[VerseType.Verse] + '1'),
@@ -153,7 +153,7 @@
         # GIVEN: A mocked out SongImport class, and a mocked out "manager"
         with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'):
             mocked_manager = MagicMock()
-            importer = SongShowPlusImport(mocked_manager)
+            importer = SongShowPlusImport(mocked_manager, filenames=[])
 
             # WHEN: Supplied with the following arguments replicating a verse order being added
             test_values = [('Verse 1', VerseType.tags[VerseType.Verse] + '1'),

=== modified file 'tests/helpers/songfileimport.py'
--- tests/helpers/songfileimport.py	2014-03-11 20:17:18 +0000
+++ tests/helpers/songfileimport.py	2014-03-29 15:02:26 +0000
@@ -89,7 +89,7 @@
         """
         Import the given file and check that it has imported correctly
         """
-        importer = self.importer_class(self.mocked_manager)
+        importer = self.importer_class(self.mocked_manager, filenames=[source_file_name])
         importer.import_wizard = self.mocked_import_wizard
         importer.stop_import_flag = False
         importer.topics = []


Follow ups