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