openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #27893
[Merge] lp:~tomasgroth/openlp/py35-test-fixes into lp:openlp
Tomas Groth has proposed merging lp:~tomasgroth/openlp/py35-test-fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/py35-test-fixes/+merge/278747
Fix projector tests.
Fix tests that fails on py35.
--
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/py35-test-fixes into lp:openlp.
=== modified file 'tests/functional/openlp_core_lib/test_projectordb.py'
--- tests/functional/openlp_core_lib/test_projectordb.py 2015-01-20 15:44:55 +0000
+++ tests/functional/openlp_core_lib/test_projectordb.py 2015-11-26 20:53:35 +0000
@@ -94,6 +94,12 @@
mocked_init_url.return_value = 'sqlite:///%s' % tmpfile
self.projector = ProjectorDB()
+ def tearDown(self):
+ """
+ Clean up
+ """
+ self.projector = None
+
def find_record_by_ip_test(self):
"""
Test find record by IP
=== modified file 'tests/functional/openlp_core_ui/test_thememanager.py'
--- tests/functional/openlp_core_ui/test_thememanager.py 2015-04-02 09:04:56 +0000
+++ tests/functional/openlp_core_ui/test_thememanager.py 2015-11-26 20:53:35 +0000
@@ -240,4 +240,4 @@
theme_manager.unzip_theme('theme.file', 'folder')
# THEN: The critical_error_message_box should have been called
- mocked_critical_error_message_box.assert_called_once(ANY, ANY)
+ self.assertEqual(mocked_critical_error_message_box.call_count, 1, 'Should have been called once')
=== modified file 'tests/functional/openlp_plugins/presentations/test_presentationcontroller.py'
--- tests/functional/openlp_plugins/presentations/test_presentationcontroller.py 2015-03-09 20:42:03 +0000
+++ tests/functional/openlp_plugins/presentations/test_presentationcontroller.py 2015-11-26 20:53:35 +0000
@@ -49,11 +49,17 @@
# _get_plugin_manager
def setUp(self):
+ self.get_thumbnail_folder_patcher = \
+ patch('openlp.plugins.presentations.lib.presentationcontroller.PresentationDocument.get_thumbnail_folder')
+ self.get_thumbnail_folder_patcher.start()
mocked_plugin = MagicMock()
mocked_plugin.settings_section = 'presentations'
self.presentation = PresentationController(mocked_plugin)
self.document = PresentationDocument(self.presentation, '')
+ def tearDown(self):
+ self.get_thumbnail_folder_patcher.stop()
+
def constructor_test(self):
"""
Test the Constructor
@@ -86,8 +92,8 @@
mocked_open.assert_any_call(os.path.join('test', 'slideNotes2.txt'), mode='wt', encoding='utf-8')
self.assertEqual(mocked_open.call_count, 3, 'There should be exactly three files opened')
mocked_open().writelines.assert_called_once_with(['uno', 'dos'])
- mocked_open().write.assert_called_any('one')
- mocked_open().write.assert_called_any('two')
+ mocked_open().write.assert_any_call('one')
+ mocked_open().write.assert_any_call('two')
def save_titles_and_notes_with_None_test(self):
"""
=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
--- tests/functional/openlp_plugins/remotes/test_router.py 2015-02-16 20:56:39 +0000
+++ tests/functional/openlp_plugins/remotes/test_router.py 2015-11-26 20:53:35 +0000
@@ -272,7 +272,6 @@
self.router.end_headers = MagicMock()
self.router.wfile = MagicMock()
mocked_image_manager = MagicMock()
- Registry.create()
Registry().register('image_manager', mocked_image_manager)
file_name = 'another%20test/slide1.png'
full_path = os.path.normpath(os.path.join('thumbnails', file_name))
@@ -295,9 +294,12 @@
self.assertEqual(self.router.end_headers.call_count, 1, 'end_headers called once')
mocked_exists.assert_called_with(urllib.parse.unquote(full_path))
self.assertEqual(mocked_image_to_byte.call_count, 1, 'Called once')
- mocked_image_manager.assert_called_any(os.path.normpath('thumbnails\\another test'),
- 'slide1.png', None, '120x90')
- mocked_image_manager.assert_called_any(os.path.normpath('thumbnails\\another test'), 'slide1.png', '120x90')
+ mocked_image_manager.add_image.assert_any_call(os.path.normpath(os.path.join('thumbnails', 'another test',
+ 'slide1.png')),
+ 'slide1.png', None, width, height)
+ mocked_image_manager.get_image.assert_any_call(os.path.normpath(os.path.join('thumbnails', 'another test',
+ 'slide1.png')),
+ 'slide1.png', width, height)
def remote_next_test(self):
"""
=== modified file 'tests/functional/openlp_plugins/songs/test_ewimport.py'
--- tests/functional/openlp_plugins/songs/test_ewimport.py 2015-01-18 13:39:21 +0000
+++ tests/functional/openlp_plugins/songs/test_ewimport.py 2015-11-26 20:53:35 +0000
@@ -403,7 +403,7 @@
# THEN: do_import should return None having called retrieve_windows_encoding with the correct encoding.
self.assertIsNone(importer.do_import(), 'do_import should return None when db_size is less than 0x800')
- mocked_retrieve_windows_encoding.assert_call(encoding)
+ mocked_retrieve_windows_encoding.assert_any_call(encoding)
def db_file_import_test(self):
"""
References