2 new commits in pytest-codecheckers:
https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/bcc7f2f21c26/ changeset: bcc7f2f21c26 user: RonnyPfannschmidt date: 2012-05-31 10:24:28 summary: complete output and short filenames affected #: 3 files diff -r fa040790a4ab2931937cdfc0efe82b664f648007 -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 codecheckers/flakes.py --- a/codecheckers/flakes.py +++ b/codecheckers/flakes.py @@ -9,6 +9,6 @@ Assignment.__init__ = assignment_monkeypatched_init -def check_file(path): - return pyflakes_check(path.read(), str(path)) +def check_file(path, filename, io): + return pyflakes_check(path.read(), filename, io) diff -r fa040790a4ab2931937cdfc0efe82b664f648007 -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 codecheckers/pep.py --- a/codecheckers/pep.py +++ b/codecheckers/pep.py @@ -1,3 +1,4 @@ +import sys import pep8 class PyTestChecker(pep8.Checker): @@ -8,17 +9,21 @@ self.ignored_errors += 1 pep8.Checker.report_error(self, line_number, offset, text, check) -def check_file(path): - - pep8.process_options(['pep8', - # ignore list taken from moin - '--ignore=E202,E221,E222,E241,E301,E302,E401,E501,E701,W391,W601,W602', - '--show-source', - '--repeat', - 'dummy file', - ]) - checker = PyTestChecker(str(path)) - #XXX: bails out on death - error_count = checker.check_all() - ignored = checker.ignored_errors - return max(error_count - ignored, 0) +def check_file(path, filename, io): + oldio = sys.stdout, sys.stderr + try: + sys.stdout = sys.stderr = io + pep8.process_options(['pep8', + # ignore list taken from moin + '--ignore=E202,E221,E222,E241,E301,E302,E401,E501,E701,W391,W601,W602', + '--show-source', + '--repeat', + 'dummy file', + ]) + checker = PyTestChecker(filename, path.readlines()) + #XXX: bails out on death + error_count = checker.check_all() + ignored = checker.ignored_errors + return max(error_count - ignored, 0) + finally: + sys.stdout , sys.stderr = oldio diff -r fa040790a4ab2931937cdfc0efe82b664f648007 -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 codecheckers/plugin.py --- a/codecheckers/plugin.py +++ b/codecheckers/plugin.py @@ -9,11 +9,13 @@ self._ep = ep def runtest(self): - c = py.io.StdCapture() + io = py.io.BytesIO() mod = self._ep.load() try: - found_errors, out, err = c.call(mod.check_file, self.fspath) - self.out, self.err = out, err + main = py.path.local() + filename = main.bestrelpath(self.fspath) + found_errors = mod.check_file(self.fspath, filename, io) + self.out = io.getvalue() except: found_errors = True self.info = py.code.ExceptionInfo() https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/0f710db69530/ changeset: 0f710db69530 user: RonnyPfannschmidt date: 2012-05-31 12:53:12 summary: add filename display affected #: 1 file diff -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 -r 0f710db6953096237ee94e4d0213a158c243b99d codecheckers/plugin.py --- a/codecheckers/plugin.py +++ b/codecheckers/plugin.py @@ -6,15 +6,16 @@ class PyCodeCheckItem(py.test.collect.Item): def __init__(self, ep, parent): py.test.collect.Item.__init__(self, ep.name, parent) + main = py.path.local() + self.filename = main.bestrelpath(self.fspath) self._ep = ep def runtest(self): + mod = self._ep.load() io = py.io.BytesIO() - mod = self._ep.load() + try: - main = py.path.local() - filename = main.bestrelpath(self.fspath) - found_errors = mod.check_file(self.fspath, filename, io) + found_errors = mod.check_file(self.fspath, self.filename, io) self.out = io.getvalue() except: found_errors = True @@ -26,10 +27,13 @@ return self.out except AttributeError: #XXX: internal error ?! - return super(PyCodeCheckItem, self).repr_failure(self.info) + self.info = py.code.ExceptionInfo() + info = getattr(self, 'info', exc_info) + return super(PyCodeCheckItem, self).repr_failure(info) def reportinfo(self): - return (self.fspath, -1, "codecheck %s" % self._ep.name) + return (self.fspath, -1, "codecheck %s %s" % ( + self._ep.name, self.filename)) class PyCheckerCollector(py.test.collect.File): Repository URL: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn