[wingide-users] Debugger not working?

Martijn Pieters mj at zopatista.com
Sun Jan 28 02:49:17 MST 2007

On 28. jan. 2007, at 03.49, Timothy Reaves wrote:
> 	I'm attempting to debug a PloneTestCase I've written.  This is  
> just a standard Python file (Plone isn't up-and-running).  When I  
> debug it, the current line jumps all over.  It stops on comments,  
> empty line,  and not on some code lines.  The output to cosole  
> isn't what it should be for the line executed.

It's not a standard python file. You are most likely using  
framework.py (very much deprecated) and it uses a lot of python  
evaluation tricks that are confusing Wing. The line jumps you see are  
in fact line numbers in framework.py and associated files, but the  
current filename is never set so Wing shows the prompt in the wrong  

Use "zopectl test" (test.py) to debug Plone and Zope unittests  
instead. Modern PloneTestCase uses test.py layers to load all the  
dependencies, and supports Five/zope3 configuration properly. In  
fact, if this is on a recent Plone/Zope combo, you will most likely  
see strange errors related to not-found users and such if you run  
with framework.py still.

To run such tests in Wing, make the following configuration changes:

Under project properties, set the following environment variables:


set /path/to/zope/bin/test.py as the main debug file (right click in  
the project file list). Also change test.py's file properties (again  
right click). On the debug tab set it's arguments to:

   -v --config-file "$INSTANCE_HOME/etc/zope.conf"

These arguments match what 'zopectl test' pass on to test.py. I  
usually add to that "-s Products.currentproduct" and "-t currenttest"  
to constrain what tests are run. See test.py --help to see what other  
options you can use.

Now, whenever you want to run your tests, just hit F5 (start debug)  
and adjust the arguments of test.py to narrow down what tests are  
run, and debug your tests. Note that during the very first run you'll  
need to ignore a handful of uncought expressions first.

Hope this helps,

Martijn Pieters

PS. Note to Wingware: I'd love to see Wing support this as part of  
the already present Zope support. Add the environment variables by  
default, and add a "Debug current Product tests" option, which runs  
test.py with the above arguments plus the -s argument with the  
current module path, and a dialog box allowing you to set further  
arguments to test.py such as the -t switch. :-)

More information about the wingide-users mailing list