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'
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()
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()
def test_moving(self, old_dict_dir, dict_dir, patch_new_qt): spell.init() assert (dict_dir / 'somedict').exists()
def test_new_qt(self, dict_dir, patch_new_qt): spell.init() assert os.environ[self.ENV] == str(dict_dir)
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