def test_find_internal_plugins(): internal = find_internal_plugins() assert len(internal) == 27 # Assert we have the same number of plugins declared in our enum # 27 internal plugins + the 'All' extra entry assert len(get_class_values(Plugins)) == 27 + 1
def test_solve_internal_plugins(): internal = [p for p in find_internal_plugins().values()] # For now we're not computing dependencies for internal plugins # TODO: Remove when the migration is complete assert solve_plugin_dependencies(internal, testing=False) == [] # Test that solver doesn't crash and returns all available plugins assert len(solve_plugin_dependencies(internal, testing=True)) == 26
def test_find_internal_plugins(): internal = find_internal_plugins() assert len(internal) == 15
def handle_exception(self, error_data, sender=None, internal_plugins=None): """ Exception ocurred in the internal console. Show a QDialog or the internal console to warn the user. Handle any exception that occurs during Spyder usage. Parameters ---------- error_data: dict The dictionary containing error data. The expected keys are: >>> error_data= { "text": str, "is_traceback": bool, "repo": str, "title": str, "label": str, "steps": str, } sender: spyder.api.plugins.SpyderPluginV2, optional The sender plugin. Default is None. Notes ----- The `is_traceback` key indicates if `text` contains plain text or a Python error traceback. The `title` and `repo` keys indicate how the error data should customize the report dialog and Github error submission. The `label` and `steps` keys allow customizing the content of the error dialog. """ text = error_data.get("text", None) is_traceback = error_data.get("is_traceback", False) title = error_data.get("title", "") label = error_data.get("label", "") steps = error_data.get("steps", "") # Skip errors without traceback (and no text) or dismiss if ((not text and not is_traceback and self.error_dlg is None) or self.dismiss_error): return if internal_plugins is None: internal_plugins = find_internal_plugins() if internal_plugins: internal_plugin_names = [] for __, val in internal_plugins.items(): name = getattr(val, 'NAME', getattr(val, 'CONF_SECTION')) internal_plugin_names.append(name) sender_name = getattr(val, 'NAME', getattr(val, 'CONF_SECTION')) is_internal_plugin = sender_name in internal_plugin_names else: is_internal_plugin = False repo = "spyder-ide/spyder" if sender is not None and not is_internal_plugin: repo = error_data.get("repo", None) try: plugin_name = sender.NAME except Exception: plugin_name = sender.CONF_SECTION if repo is None: raise Exception( 'External plugin "{}" does not define "repo" key in ' 'the "error_data" dictionary!'.format(plugin_name) ) if self.get_option('show_internal_errors'): if self.error_dlg is None: self.error_dlg = SpyderErrorDialog(self) self.error_dlg.set_color_scheme(self.get_option('color_theme')) self.error_dlg.close_btn.clicked.connect(self.close_error_dlg) self.error_dlg.rejected.connect(self.remove_error_dlg) self.error_dlg.details.go_to_error.connect(self.go_to_error) # Set the report repository self.error_dlg.set_github_repo_org(repo) if title: self.error_dlg.set_title(title) self.error_dlg.title.setEnabled(False) if label: self.error_dlg.main_label.setText(label) self.error_dlg.submit_btn.setEnabled(True) if steps: self.error_dlg.steps_text.setText(steps) self.error_dlg.set_require_minimum_length(False) self.error_dlg.append_traceback(text) self.error_dlg.show() elif DEV or get_debug_level(): self.change_visibility(True, True)
def test_solve_internal_plugins(): internal = [p for p in find_internal_plugins().values()] # Test that solver doesn't crash and returns all available plugins solved_dependencies = solve_plugin_dependencies(internal) print(solved_dependencies) assert len(solve_plugin_dependencies(internal)) == 27
def test_find_internal_plugins(): internal = find_internal_plugins() assert len(internal) == 26 # Assert we have the same number of plugins declared in our enum assert len(get_class_values(Plugins)) == 26