Farm Development

Hacking python frames

At the last ChiPy meeting, Ian Bicking showed a fun little hack to install a doctest output checker from within a running doctest. The hack goes so far as to backtrack through the internal frame stack, locate the doctest frame, change some of its local vars, then switch out a code object with a new one (the func_code attribute). Huzzah!

Take a look at lxml.doctestcompare—scroll to the tempinstall() method. Looks like there might even be a module forthcoming (dtopt?) to aid in this kind of on-the-fly monkey patching madness :)

Note: HTML tags will be stripped. Hit enter twice for a new paragraph.

Recent Projects

  • JSTestNet

    Like botnet but for JS tests in CI.

  • Nose Nicedots

    Nose plugin that prints nicer dots.

  • Fudge

    Mock objects for testing.

  • Fixture

    Loading and referencing test data.

  • NoseJS

    Nose plugin that runs JavaScript tests for a Python project.

  • Wikir

    converts reST to various Wiki formats.