From 3342871c734f8d9c8ca859a4be77f82e7083bdea Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Mon, 26 Jul 2010 19:01:29 -0400 Subject: Removing doctests support since I don't really like doctests. --- machineout.py | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/machineout.py b/machineout.py index 3b47e68..fc62875 100644 --- a/machineout.py +++ b/machineout.py @@ -4,7 +4,6 @@ It is intended to be use to integrate nose with your IDE such as Vim. """ import re -import os.path import traceback from nose.plugins import Plugin @@ -12,14 +11,6 @@ from nose.plugins import Plugin __all__ = ['NoseMachineReadableOutput'] -try: - import doctest - doctest_fname = re.sub('\.py.?$', '.py', doctest.__file__) - del doctest -except ImportError: - doctest_fname = None - - class dummystream: def write(self, *arg): @@ -32,14 +23,6 @@ class dummystream: pass -def is_doctest_traceback(fname): - return fname == doctest_fname - - -class PluginError(Exception): - pass - - class NoseMachineReadableOutput(Plugin): """ Output errors and failures in a machine-readable way. @@ -87,25 +70,9 @@ class NoseMachineReadableOutput(Plugin): except IndexError: fname, lineno, funname, msg = fallback - # explicit support for doctests is needed - if is_doctest_traceback(fname): - # doctest traceback includes pre-formatted error message - # which we parse (in a very crude way). - n = value.args[0].rindex('-'*20) - formatted_msg = value.args[0][n+20+1:] - m = self.doctest_failure_re.match(formatted_msg) - if not m: - raise RuntimeError("Can't parse doctest output: %r" % value.args[0]) - fname, lineno, funname, msg = m.groups() - if '.' in funname: # strip module package name, if any - funname = funname.split('.')[-1] - lineno = int(lineno) - lines = msg.split('\n') - msg0 = lines[0] - else: - lines = traceback.format_exception_only(exctype, value) - lines = [line.strip('\n') for line in lines] - msg0 = lines[0] + lines = traceback.format_exception_only(exctype, value) + lines = [line.strip('\n') for line in lines] + msg0 = lines[0] fname = self.format_testfname(fname) prefix = "%s:%d" % (fname, lineno) -- cgit v1.2.3