コード例 #1
0
    def test_moving_oserror(self, mocker, caplog, old_dict_dir, dict_dir,
                            patch_new_qt):
        mocker.patch('shutil.copytree', side_effect=OSError)

        with caplog.at_level(logging.ERROR):
            spell.init()

        assert caplog.messages[0] == 'Failed to copy old dictionaries'
コード例 #2
0
def init(args):
    """Initialize the global QWebSettings."""
    if (args.enable_webengine_inspector and
            not hasattr(QWebEnginePage, 'setInspectedPage')):  # only Qt < 5.11
        os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = str(utils.random_port())

    webengineglimpsescheme.init()
    spell.init()

    _init_profiles()
    config.instance.changed.connect(_update_settings)

    global global_settings
    global_settings = WebEngineSettings(_SettingsWrapper())
    global_settings.init_settings()
コード例 #3
0
 def test_moving_existing_destdir(self, old_dict_dir, dict_dir,
                                  patch_new_qt):
     dict_dir.ensure(dir=True)
     spell.init()
     assert not (dict_dir / 'somedict').exists()
コード例 #4
0
 def test_moving(self, old_dict_dir, dict_dir, patch_new_qt):
     spell.init()
     assert (dict_dir / 'somedict').exists()
コード例 #5
0
 def test_new_qt(self, dict_dir, patch_new_qt):
     spell.init()
     assert os.environ[self.ENV] == str(dict_dir)
コード例 #6
0
 def test_old_qt(self, monkeypatch):
     monkeypatch.setattr(spell.qtutils, 'version_check',
                         lambda _ver, compiled: False)
     spell.init()
     assert self.ENV not in os.environ