← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~springermac/openlp/settings-test-fix into lp:openlp

 

Jonathan Springer has proposed merging lp:~springermac/openlp/settings-test-fix into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~springermac/openlp/settings-test-fix/+merge/210703

Fixes tests that use settings to actually use temporary settings file.
-- 
https://code.launchpad.net/~springermac/openlp/settings-test-fix/+merge/210703
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'tests/functional/openlp_core_common/test_settings.py'
--- tests/functional/openlp_core_common/test_settings.py	2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_core_common/test_settings.py	2014-03-12 22:20:22 +0000
@@ -46,6 +46,7 @@
         """
         Create the UI
         """
+        Settings.setDefaultFormat(Settings.IniFormat)
         fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
         self.application = QtGui.QApplication.instance()
@@ -55,7 +56,6 @@
         Delete all the C++ objects at the end so that we don't have a segfault
         """
         del self.application
-        os.unlink(self.ini_file)
         os.unlink(Settings().fileName())
 
     def settings_basic_test(self):

=== modified file 'tests/functional/openlp_core_utils/test_actions.py'
--- tests/functional/openlp_core_utils/test_actions.py	2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_core_utils/test_actions.py	2014-03-12 22:20:22 +0000
@@ -49,6 +49,7 @@
         Prepare the tests
         """
         self.action_list = ActionList.get_instance()
+        Settings.setDefaultFormat(Settings.IniFormat)
         self.settings = Settings()
         fd, self.ini_file = mkstemp('.ini')
         self.settings.set_filename(self.ini_file)
@@ -59,7 +60,7 @@
         Clean up
         """
         self.settings.endGroup()
-        os.unlink(self.ini_file)
+        os.unlink(Settings().fileName())
 
     def test_add_action_same_parent(self):
         """

=== modified file 'tests/functional/openlp_plugins/presentations/test_pdfcontroller.py'
--- tests/functional/openlp_plugins/presentations/test_pdfcontroller.py	2014-03-04 20:18:14 +0000
+++ tests/functional/openlp_plugins/presentations/test_pdfcontroller.py	2014-03-12 22:20:22 +0000
@@ -55,6 +55,7 @@
         """
         Set up the components need for all tests.
         """
+        Settings.setDefaultFormat(Settings.IniFormat)
         self.fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
         self.application = QtGui.QApplication.instance()
@@ -69,7 +70,7 @@
         """
         del self.application
         try:
-            os.unlink(self.ini_file)
+            os.unlink(Settings().fileName())
             shutil.rmtree(self.thumbnail_folder)
             shutil.rmtree(self.temp_folder)
         except OSError:

=== modified file 'tests/functional/openlp_plugins/remotes/test_remotetab.py'
--- tests/functional/openlp_plugins/remotes/test_remotetab.py	2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_plugins/remotes/test_remotetab.py	2014-03-12 22:20:22 +0000
@@ -62,6 +62,7 @@
         """
         Create the UI
         """
+        Settings.setDefaultFormat(Settings.IniFormat)
         self.fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
         self.application = QtGui.QApplication.instance()
@@ -77,7 +78,7 @@
         del self.parent
         del self.form
         os.close(self.fd)
-        os.unlink(self.ini_file)
+        os.unlink(Settings().fileName())
 
     def get_ip_address_default_test(self):
         """

=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
--- tests/functional/openlp_plugins/remotes/test_router.py	2014-01-11 22:05:38 +0000
+++ tests/functional/openlp_plugins/remotes/test_router.py	2014-03-12 22:20:22 +0000
@@ -61,6 +61,7 @@
         """
         Create the UI
         """
+        Settings.setDefaultFormat(Settings.IniFormat)
         self.fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
         self.application = QtGui.QApplication.instance()
@@ -73,7 +74,7 @@
         """
         del self.application
         os.close(self.fd)
-        os.unlink(self.ini_file)
+        os.unlink(Settings().fileName())
 
     def password_encrypter_test(self):
         """

=== modified file 'tests/functional/openlp_plugins/songs/test_mediaitem.py'
--- tests/functional/openlp_plugins/songs/test_mediaitem.py	2013-12-13 17:44:05 +0000
+++ tests/functional/openlp_plugins/songs/test_mediaitem.py	2014-03-12 22:20:22 +0000
@@ -28,6 +28,7 @@
                 patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'):
             self.media_item = SongMediaItem(None, MagicMock())
 
+        Settings.setDefaultFormat(Settings.IniFormat)
         fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
         self.application = QtGui.QApplication.instance()
@@ -40,7 +41,6 @@
         del self.application
         # Not all tests use settings!
         try:
-            os.unlink(self.ini_file)
             os.unlink(Settings().fileName())
         except Exception:
             pass

=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py	2014-03-12 22:20:22 +0000
@@ -23,6 +23,7 @@
         """
         Some pre-test setup required.
         """
+        Settings.setDefaultFormat(Settings.IniFormat)
         fd, self.ini_file = mkstemp('.ini')
         self.temp_dir = mkdtemp('openlp')
         Settings().set_filename(self.ini_file)
@@ -41,7 +42,7 @@
         del self.main_window
         Settings().remove('advanced/data path')
         shutil.rmtree(self.temp_dir)
-        os.unlink(self.ini_file)
+        os.unlink(Settings().fileName())
 
     def find_plugins_test(self):
         """

=== modified file 'tests/interfaces/openlp_core_ui/test_thememanager.py'
--- tests/interfaces/openlp_core_ui/test_thememanager.py	2014-03-10 19:56:36 +0000
+++ tests/interfaces/openlp_core_ui/test_thememanager.py	2014-03-12 22:20:22 +0000
@@ -48,6 +48,7 @@
         """
         Create the UI
         """
+        Settings.setDefaultFormat(Settings.IniFormat)
         fd, self.ini_file = mkstemp('.ini')
         Settings().set_filename(self.ini_file)
         old_app_instance = QtCore.QCoreApplication.instance()
@@ -62,7 +63,6 @@
         """
         Delete all the C++ objects at the end so that we don't have a segfault
         """
-        os.unlink(self.ini_file)
         os.unlink(Settings().fileName())
 
     def initialise_test(self):


Follow ups