Eclipse plugin for running Django tests.

I’ve recently been reading Foundations of Agile Python Development and tried the PyDev plugin for Eclipse at its recommendation. I had been under the impression that the plugin was still rather immature but have since been pleasantly surprised. Besides unexpected stability, PyDev even has support for writing Django applications. There was, however, one issue with the plugin that I had some umbrage with. Although there are shortcut/run configuration possibilities for running Python Unittests and even the  Django test suite, there was no way (that I found) to run individual tests without creating a custom run configuration for each one.

Since the existing plugin was not capable of meeting that requirement, Josh Wolfe from ResultOf(programming) = Moods.happy and I collaborated to create a custom plugin that provides exactly this functionality. The latest development code for the plugin can be found on GitHub at django_testing and a packaged build can be found here: com.royvandewater.django_testing_1.0.1.jar

To install, simply drop it into your eclipse plugins directory (it was ~/.eclipse/org.eclipse.platform_3.5.0_x/plugins/). To use, place the cursor anywhere within a file containing Django tests and press Alt+Shift+F11. If your cursor is currently inside of a specific test method, it will run only that method. If it is outside any test methods but still within the class, the plugin will execute all test methods in that class. Lastly, if you are in a function where the name is not prefixed with “test”, the plugin will execute the last run test. This is great for writing a test and running it from another file as you write the implementation.

    • Brian Schmitz
    • October 14th, 2010

    Awesome. Thanks alot. The python, I use was in a different location, so I had to modify the plugin slightly to make it work for me.

    If you continue working on it, I would love to know about your exploits. If I have time, I may try to extend what you have done a bit, so I can run the tests in the debugger.

  1. No trackbacks yet.