예제 #1
0
    def _backupPreferences(self):

        preferencesFileName: str = Preferences.getPreferencesLocation()
        source: str = preferencesFileName
        target: str = f"{preferencesFileName}{TestPreferences.BACKUP_SUFFIX}"
        if osPath.exists(source):
            try:
                copyfile(source, target)
            except IOError as e:
                self.logger.error(f'Unable to copy file. {e}')
예제 #2
0
    def __init__(self):

        self._setupSystemLogging()
        self.logger: Logger = getLogger(__name__)

        Preferences.determinePreferencesLocation()
        configFile: Path = Path(Preferences.getPreferencesLocation())
        #
        # Will create a default one if necessary
        #
        if configFile.exists() is False:
            self._preferences = Preferences()
예제 #3
0
    def _restoreBackup(self):

        preferencesFileName: str = Preferences.getPreferencesLocation()
        source: str = f"{preferencesFileName}{TestPreferences.BACKUP_SUFFIX}"
        target: str = preferencesFileName
        if osPath.exists(source):
            try:
                copyfile(source, target)
            except IOError as e:
                self.logger.error(f"Unable to copy file. {e}")

            osRemove(source)
        else:
            osRemove(target)