コード例 #1
0
ファイル: StyleCheck.py プロジェクト: phf/idle-extensions
    def check_style(self, ev=None):
        """ Runs pep8 stylecheck, captures output and prints to new
            output window."""

        sbind = ScriptBinding(self.editwin)
        filename = sbind.getfilename()

        if filename:
            try:
                p = sub.Popen(['pep8', filename],
                              stdout=sub.PIPE, stderr=sub.PIPE)
                output, errors = p.communicate()

                if output.strip():
                    output_short = '\n'.join(
                        [line.split('/')[-1]
                         for line in output.split('\n')[:-1]])
                    # shorten pathname in each line of output
                else:
                    output_short = "Passed all checks!"

            except OSError:
                output_short = "Please install pep8."

            win = OutputWindow(self.editwin.flist)
            win.write(output_short)
コード例 #2
0
ファイル: DocTest.py プロジェクト: phf/idle-extensions
    def doc_test(self, ev=None):
        """ Run doctests on the current module"""

        sbind = ScriptBinding(self.editwin)
        filename = sbind.getfilename()

        if filename:
            p = sub.Popen(['python', '-m', 'doctest', '-v', filename],
                            stdout=sub.PIPE, stderr=sub.PIPE)
            output, errors = p.communicate()

            win = OutputWindow(self.editwin.flist)
            win.write(output + '\n' + errors)  # write to output window
コード例 #3
0
    def doc_test(self, ev=None):
        """ Run doctests on the current module"""

        sbind = ScriptBinding(self.editwin)
        filename = sbind.getfilename()

        if filename:
            p = sub.Popen(['python', '-m', 'doctest', '-v', filename],
                          stdout=sub.PIPE,
                          stderr=sub.PIPE)
            output, errors = p.communicate()

            win = OutputWindow(self.editwin.flist)
            win.write(output + '\n' + errors)  # write to output window