forked from openlp/openlp
Fixes settings initialization in tests to actually use temporary ini file.
This commit is contained in:
parent
03d6d374a4
commit
6f05711414
@ -46,6 +46,7 @@ class TestSettings(TestCase):
|
|||||||
"""
|
"""
|
||||||
Create the UI
|
Create the UI
|
||||||
"""
|
"""
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
fd, self.ini_file = mkstemp('.ini')
|
fd, self.ini_file = mkstemp('.ini')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
self.application = QtGui.QApplication.instance()
|
self.application = QtGui.QApplication.instance()
|
||||||
@ -55,7 +56,6 @@ class TestSettings(TestCase):
|
|||||||
Delete all the C++ objects at the end so that we don't have a segfault
|
Delete all the C++ objects at the end so that we don't have a segfault
|
||||||
"""
|
"""
|
||||||
del self.application
|
del self.application
|
||||||
os.unlink(self.ini_file)
|
|
||||||
os.unlink(Settings().fileName())
|
os.unlink(Settings().fileName())
|
||||||
|
|
||||||
def settings_basic_test(self):
|
def settings_basic_test(self):
|
||||||
|
@ -59,7 +59,7 @@ class TestActionList(TestCase):
|
|||||||
Clean up
|
Clean up
|
||||||
"""
|
"""
|
||||||
self.settings.endGroup()
|
self.settings.endGroup()
|
||||||
os.unlink(self.ini_file)
|
os.unlink(Settings().fileName())
|
||||||
|
|
||||||
def test_add_action_same_parent(self):
|
def test_add_action_same_parent(self):
|
||||||
"""
|
"""
|
||||||
|
@ -55,6 +55,7 @@ class TestPdfController(TestCase):
|
|||||||
"""
|
"""
|
||||||
Set up the components need for all tests.
|
Set up the components need for all tests.
|
||||||
"""
|
"""
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
self.fd, self.ini_file = mkstemp('.ini')
|
self.fd, self.ini_file = mkstemp('.ini')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
self.application = QtGui.QApplication.instance()
|
self.application = QtGui.QApplication.instance()
|
||||||
@ -69,7 +70,7 @@ class TestPdfController(TestCase):
|
|||||||
"""
|
"""
|
||||||
del self.application
|
del self.application
|
||||||
try:
|
try:
|
||||||
os.unlink(self.ini_file)
|
os.unlink(Settings().fileName())
|
||||||
shutil.rmtree(self.thumbnail_folder)
|
shutil.rmtree(self.thumbnail_folder)
|
||||||
shutil.rmtree(self.temp_folder)
|
shutil.rmtree(self.temp_folder)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
@ -62,6 +62,7 @@ class TestRemoteTab(TestCase):
|
|||||||
"""
|
"""
|
||||||
Create the UI
|
Create the UI
|
||||||
"""
|
"""
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
self.fd, self.ini_file = mkstemp('.ini')
|
self.fd, self.ini_file = mkstemp('.ini')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
self.application = QtGui.QApplication.instance()
|
self.application = QtGui.QApplication.instance()
|
||||||
@ -77,7 +78,7 @@ class TestRemoteTab(TestCase):
|
|||||||
del self.parent
|
del self.parent
|
||||||
del self.form
|
del self.form
|
||||||
os.close(self.fd)
|
os.close(self.fd)
|
||||||
os.unlink(self.ini_file)
|
os.unlink(Settings().fileName())
|
||||||
|
|
||||||
def get_ip_address_default_test(self):
|
def get_ip_address_default_test(self):
|
||||||
"""
|
"""
|
||||||
|
@ -61,6 +61,7 @@ class TestRouter(TestCase):
|
|||||||
"""
|
"""
|
||||||
Create the UI
|
Create the UI
|
||||||
"""
|
"""
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
self.fd, self.ini_file = mkstemp('.ini')
|
self.fd, self.ini_file = mkstemp('.ini')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
self.application = QtGui.QApplication.instance()
|
self.application = QtGui.QApplication.instance()
|
||||||
@ -73,7 +74,7 @@ class TestRouter(TestCase):
|
|||||||
"""
|
"""
|
||||||
del self.application
|
del self.application
|
||||||
os.close(self.fd)
|
os.close(self.fd)
|
||||||
os.unlink(self.ini_file)
|
os.unlink(Settings().fileName())
|
||||||
|
|
||||||
def password_encrypter_test(self):
|
def password_encrypter_test(self):
|
||||||
"""
|
"""
|
||||||
|
@ -28,6 +28,7 @@ class TestMediaItem(TestCase):
|
|||||||
patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'):
|
patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'):
|
||||||
self.media_item = SongMediaItem(None, MagicMock())
|
self.media_item = SongMediaItem(None, MagicMock())
|
||||||
|
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
fd, self.ini_file = mkstemp('.ini')
|
fd, self.ini_file = mkstemp('.ini')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
self.application = QtGui.QApplication.instance()
|
self.application = QtGui.QApplication.instance()
|
||||||
@ -40,7 +41,6 @@ class TestMediaItem(TestCase):
|
|||||||
del self.application
|
del self.application
|
||||||
# Not all tests use settings!
|
# Not all tests use settings!
|
||||||
try:
|
try:
|
||||||
os.unlink(self.ini_file)
|
|
||||||
os.unlink(Settings().fileName())
|
os.unlink(Settings().fileName())
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
@ -23,6 +23,7 @@ class TestPluginManager(TestCase):
|
|||||||
"""
|
"""
|
||||||
Some pre-test setup required.
|
Some pre-test setup required.
|
||||||
"""
|
"""
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
fd, self.ini_file = mkstemp('.ini')
|
fd, self.ini_file = mkstemp('.ini')
|
||||||
self.temp_dir = mkdtemp('openlp')
|
self.temp_dir = mkdtemp('openlp')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
@ -38,7 +39,7 @@ class TestPluginManager(TestCase):
|
|||||||
del self.main_window
|
del self.main_window
|
||||||
Settings().remove('advanced/data path')
|
Settings().remove('advanced/data path')
|
||||||
shutil.rmtree(self.temp_dir)
|
shutil.rmtree(self.temp_dir)
|
||||||
os.unlink(self.ini_file)
|
os.unlink(Settings().fileName())
|
||||||
|
|
||||||
def find_plugins_test(self):
|
def find_plugins_test(self):
|
||||||
"""
|
"""
|
||||||
|
@ -48,6 +48,7 @@ class TestThemeManager(TestCase):
|
|||||||
"""
|
"""
|
||||||
Create the UI
|
Create the UI
|
||||||
"""
|
"""
|
||||||
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
fd, self.ini_file = mkstemp('.ini')
|
fd, self.ini_file = mkstemp('.ini')
|
||||||
Settings().set_filename(self.ini_file)
|
Settings().set_filename(self.ini_file)
|
||||||
self.app = QtGui.QApplication([])
|
self.app = QtGui.QApplication([])
|
||||||
@ -58,7 +59,6 @@ class TestThemeManager(TestCase):
|
|||||||
"""
|
"""
|
||||||
Delete all the C++ objects at the end so that we don't have a segfault
|
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())
|
os.unlink(Settings().fileName())
|
||||||
del self.app
|
del self.app
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user