def finished(self): """ Called when the unit test process has finished. This function reads the results and emits `sig_finished`. """ qbytearray = self.process.readAllStandardOutput() locale_codec = QTextCodec.codecForLocale() output = to_text_string(locale_codec.toUnicode(qbytearray.data())) testresults = self.load_data() self.sig_finished.emit(testresults, output)
from spyder.utils import icon_manager as ima from spyder.utils.qthelpers import (create_toolbutton, get_item_user_text, set_item_user_text) from spyder.utils.programs import shell_split from spyder.widgets.comboboxes import PythonModulesComboBox from spyder.utils.misc import add_pathlist_to_PYTHONPATH, getcwd_or_home from spyder.widgets.variableexplorer.texteditor import TextEditor # This is needed for testing this module as a stand alone script try: _ = get_translation("profiler", "spyder_profiler") except KeyError as error: import gettext _ = gettext.gettext locale_codec = QTextCodec.codecForLocale() def is_profiler_installed(): from spyder.utils.programs import is_module_installed return is_module_installed('cProfile') and is_module_installed('pstats') class ProfilerWidget(QWidget): """ Profiler widget """ DATAPATH = get_conf_path('profiler.results') VERSION = '0.0.1' redirect_stdio = Signal(bool)
from spyder.utils.encoding import to_unicode_from_fs from spyder.utils.qthelpers import create_toolbutton from spyder.widgets.comboboxes import (is_module_or_package, PythonModulesComboBox) from spyder.widgets.onecolumntree import OneColumnTree from spyder.widgets.variableexplorer.texteditor import TextEditor # This is needed for testing this module as a stand alone script try: _ = get_translation("pylint", "spyder_pylint") except KeyError as error: import gettext _ = gettext.gettext locale_codec = QTextCodec.codecForLocale() PYLINT_REQVER = '>=0.25' PYLINT_VER = pylint.__version__ dependencies.add("pylint", _("Static code analysis"), required_version=PYLINT_REQVER, installed_version=PYLINT_VER) #TODO: display results on 3 columns instead of 1: msg_id, lineno, message class ResultsTree(OneColumnTree): sig_edit_goto = Signal(str, int, str) def __init__(self, parent): OneColumnTree.__init__(self, parent) self.filename = None self.results = None self.data = None
# Third party imports from qtpy.QtCore import (QByteArray, QProcess, Qt, QTextCodec, QTimer, Signal, Slot) from qtpy.QtWidgets import (QHBoxLayout, QInputDialog, QLabel, QLineEdit, QMenu, QToolButton, QVBoxLayout, QWidget) # Local imports from spyderlib.config.base import _, get_conf_path from spyderlib.py3compat import is_text_string, to_text_string from spyderlib.utils import icon_manager as ima from spyderlib.utils.qthelpers import (add_actions, create_action, create_toolbutton) LOCALE_CODEC = QTextCodec.codecForLocale() def add_pathlist_to_PYTHONPATH(env, pathlist, drop_env=False): # PyQt API 1/2 compatibility-related tests: assert isinstance(env, list) assert all([is_text_string(path) for path in env]) pypath = "PYTHONPATH" pathstr = os.pathsep.join(pathlist) if os.environ.get(pypath) is not None and not drop_env: for index, var in enumerate(env[:]): if var.startswith(pypath+'='): env[index] = var.replace(pypath+'=', pypath+'='+pathstr+os.pathsep) env.append('OLD_PYTHONPATH='+os.environ[pypath])
def read_all_process_output(self): """Read and return all output from `self.process` as unicode.""" qbytearray = self.process.readAllStandardOutput() locale_codec = QTextCodec.codecForLocale() return to_text_string(locale_codec.toUnicode(qbytearray.data()))