I use eclipse with the excellent pydev for my coding. Yes, I know I should be using emacs but at work I’m forced to use windows so I like the way eclipse insulates me from the OS. Also, I could never get over the ugliness of emacs default fonts (anyone know to make it look better?). I also like not having to think about versioning, as subclipse does a great job of doing it all for me.
I also use nose for testing. Even written a few plugins (eg one that dumps the test results into a nice excel spreadsheet to give to the QA department) and contibuted a few patches. The test attributes are a great feature, and it allows you to mix unittest, simple test methods and doctests without thinking about it. However, I was inspired by this post on automating nose whenever a source file changes to look at doing the same in eclipse. Turns out, its easier than I could have imagined.
Under project properties, define a new ‘program’ builder. Set the location to the nosetests script, set its working directory to ${project loc}, append any command line options you want (eg –with-coverage -a !slow,!gui) and then, under the build options tab, tick the ‘launch in background’ and ‘during auto builds’. Now, whenever you save the changes to a file, the test results will come out in the console.
Unfortunately, it seems eclipse cannot share builders between projects. However, you can setup nose as an external tool. Then, when you need it as a builder you can import it. It’s also quite nice to have an external tool set up that runs nose only on the selected file. To do this set up an external tool as before, but instead set working directory to {$container loc} and put {$resource loc} in the command line arguments.
-
1
Pingback on Oct 17th, 2006 at 7:47 am
[…] Etter en masse leting fant jeg endelig svaret her […]
Leave a Comment
Latest Entries
- Links for January 12th through March 7th
- Links for January 4th through January 11th
- Links for December 31st through January 3rd
- Links for December 21st through December 30th
- Egyptians to extend copyright term by ~4,000 years
- WTO allows piracy in Antigua
- Krugman on the subprime thing
- Drowning in spam
- Tenori On - I want
- Finally: a simple tool capable of producing debs, rpms, etc.
Jul 29th, 2006 at 4:09 pm
Very cool.. what about other file types in the same directory, would they trigger the build?
I ues Kid for HTML generation. I’ve added the .kid into nosy: changing the template regenerates the HTML, and a meta refresh tag reloads the page in the browser. So you can make a change in Eclipse and see the results in the browser in ~30 seconds.
Are you familiar with showmedo (http://showmedo.com/videos/python)? A screencast of this technique would be great.
- Jeff
Jul 29th, 2006 at 7:36 pm
Yeah, the eclipse auto builder runs whenever any file changes so it will pick up the html changes too.
Aug 5th, 2007 at 11:09 pm
If the nosetests script is on your execute path, you don’t have to specify its exact location by using
${system_path:nosetests}
as the location. This is very helpful when a project file is shared across different platforms, as the path is not hard-coded.
Jun 17th, 2008 at 1:32 pm
Nice recipe. Do you know if it is possible to automatically set PYTHONPATH enviroment using the pydev Pythonpath settings?