[wingide-users] Re: Debugger not working?

Timothy Reaves treaves at silverfieldstech.com
Sun Jan 28 12:07:08 MST 2007

Martijn Pieters wrote:
> 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 file.
> 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:
>   SOFTWARE_HOME="/path/to/zope/lib/python"
>   INSTANCE_HOME="/path/to/zope/instance"
> 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. :-)

	First, thanks for the reply; I greatly appreciate it.  It does help, 
but I have a couple of questions.  And with the Wing guys already 
supporting Zope so well, it would be cool for them to add this too!

	My project explorer shows my Plone instance, and lib/python under Zope. 
  zope/bin is not there.  So how do I set test.py to the default debugable?

	The last two lines of my test are:
if __name__ == '__main__':
does what you say mean I should remove the call to framework()?

	I'll muddle around some, but the test.py may prevent me.

	Again, thanks!

More information about the wingide-users mailing list