diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 307239032..b143d6e01 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -47,8 +47,7 @@ from openlp.core.lib.ui import UiStrings, create_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm from openlp.core.ui.media import MediaController -from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version, \ - get_filesystem_encoding +from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.ui.firsttimeform import FirstTimeForm @@ -903,7 +902,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Make sure it's a .conf file. if not export_file_name.endswith(u'conf'): export_file_name += u'.conf' - temp_file = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', u'exportConf.tmp') + temp_file = os.path.join(gettempdir(), u'openlp', u'exportConf.tmp') self.save_settings() setting_sections = [] # Add main sections. diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index caba4b30f..99ef941ed 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -39,7 +39,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Registry, Settings, UiStrings, translate, check_directory_exists from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings -from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding +from openlp.core.utils import AppLocation, delete_file from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, BiblesResourcesDB from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract @@ -71,7 +71,7 @@ class BibleUpgradeForm(OpenLPWizard): self.suffix = u'.sqlite' self.settings_section = u'bibles' self.path = AppLocation.get_section_data_path(self.settings_section) - self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp') + self.temp_dir = os.path.join(gettempdir(), u'openlp') self.files = self.manager.old_bible_databases self.success = {} self.new_bibles = {} diff --git a/tests/functional/openlp_core_utils/test_utils.py b/tests/functional/openlp_core_utils/test_utils.py index 8e3a427ed..9409f0803 100644 --- a/tests/functional/openlp_core_utils/test_utils.py +++ b/tests/functional/openlp_core_utils/test_utils.py @@ -5,42 +5,13 @@ from unittest import TestCase from mock import patch -from openlp.core.utils import clean_filename, get_filesystem_encoding, _get_frozen_path, get_locale_key, \ - get_natural_key, split_filename +from openlp.core.utils import clean_filename, _get_frozen_path, get_locale_key, get_natural_key, split_filename class TestUtils(TestCase): """ A test suite to test out various methods around the AppLocation class. """ - def get_filesystem_encoding_test(self): - """ - Test the get_filesystem_encoding() function - """ - with patch(u'openlp.core.utils.sys.getfilesystemencoding') as mocked_getfilesystemencoding, \ - patch(u'openlp.core.utils.sys.getdefaultencoding') as mocked_getdefaultencoding: - # GIVEN: sys.getfilesystemencoding returns "cp1252" - mocked_getfilesystemencoding.return_value = u'cp1252' - - # WHEN: get_filesystem_encoding() is called - result = get_filesystem_encoding() - - # THEN: getdefaultencoding should have been called - mocked_getfilesystemencoding.assert_called_with() - assert not mocked_getdefaultencoding.called - assert result == u'cp1252', u'The result should be "cp1252"' - - # GIVEN: sys.getfilesystemencoding returns None and sys.getdefaultencoding returns "utf-8" - mocked_getfilesystemencoding.return_value = None - mocked_getdefaultencoding.return_value = u'utf-8' - - # WHEN: get_filesystem_encoding() is called - result = get_filesystem_encoding() - - # THEN: getdefaultencoding should have been called - mocked_getfilesystemencoding.assert_called_with() - mocked_getdefaultencoding.assert_called_with() - assert result == u'utf-8', u'The result should be "utf-8"' def get_frozen_path_test(self): """