Random notes from mg

a blog by Marius Gedminas

Marius is a Python hacker. He works for Programmers of Vilnius, a small Python/Zope 3 startup. He has a personal home page at http://gedmin.as. His email is marius@gedmin.as. He does not like spam, but is not afraid of it.

Sat, 14 Jul 2007

Post-EuroPython 2007 sprint day 2

Previous entry.

During the second day I refactored the Zope 3 test runner to make nearly all of its output go through a single OutputFormatter class (in the output-refactoring branch), then created a subclass of it that uses ANSI color codes to highlight error messages (in the colorized-output branch). I've had this luxury before, and I can attest that it does increase productivity (being able to spot filenames and line numbers between several-hundred-line diffs produced by testbrowser tests is invaluable).

Zope 3 test
    runner in a white terminal Zope 3 test
    runner in a black terminal

I also had lots of fun trying to get the unit test coverage of the test runner. There's a bit of a chicken and egg problem here: to get accurate coverage data you want the tracer to be enabled during import time, but you cannot do that since the test runner doesn't exist yet. Hacks with reload() and del sys.modules['zope.testing.testrunner'] didn't work due to excessive monkey-patching in the test runner that caused infinite recursion. In the end I made a second copy of the module and used it to run the test suite of the first copy. (42% of the code is not covered by unit tests, according to the coverage report. I don't entirely trust that report, though.)

On the last day I intend to clean up the code, add the unit tests for my colorizer, and merge it to trunk.


Technorati tag:

posted at 12:35 | python permanent link to this entry | 0 comments

Name (required)

E-mail (will not be shown)


Comment (some HTML allowed)