Diff for "Launchpad Tricks and Tips"

Not logged in - Log In / Register

Differences between revisions 2 and 3
Revision 2 as of 2009-09-12 03:56:00
Size: 1519
Editor: barry
Comment:
Revision 3 as of 2009-09-12 04:10:58
Size: 21
Editor: kfogel
Comment: Just redirect to Debugging for now.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#FORMAT rst

==================================
Launchpad Tips, Tricks and Tidbits
==================================

This page collects little tips, tricks, and tidbits that might make your experience hacking on Launchpad a little more fun. They're presented here in no particular order -- please add yours!


Debugging stories/pagetests
===========================

Debugging stories (a.k.a. pagetests) can be kind of a pain because they build up state as they go. So if a test fails down deep in the doctest, and you want to see what the page really looks like at that point, you'd normally have to manually click through each step in the doctest until you get to the place that's broken.

But there's an easier way!

Just add this at the point where your pagetest is failing::

    >>> stop()

This is just a convenience wrapper around ``pdb.set_trace()`` except that it also redirects stdout back to your console. When your pagetest hits this line, you'll be dropped into the debugger. Now, go to a different shell and type::

    % make LPCONFIG=testrunner run

This starts up the appserver, except that it will use the ``testrunner`` configuration. What's cool about that is that this configuration attaches to the same database as the pagetest you're now stopped inside of. Meaning, all that state your doctest has built up, is available to your browser. So just hit the URL of the page that your doctest is failing on, and see it in all it's wondrous, albeit borked, glory.
 
#redirect Debugging

Launchpad Tricks and Tips (last edited 2009-09-12 04:10:58 by kfogel)