Friday, December 10, 2010

Improved unittest support in Pydev

Pydev 1.6.4 is still not released, but the first nightly with the new support for unittest is now available (see on instructions for getting the nightly).

The major features added are:

1. A PyUnit view is now available to show the results of unittests
2. The nose and Py.test test runners are now also supported

The interesting features related to seeing the tests are:

- The results of tests are shown, along with a green/red bar (or if you're with Aptana Studio, following the color theme)
- The time a test took to run is shown (and may be used to sort the tree)
- The errors/output are shown by selecting the test run or just hovering over the items
- A filter to show only errors is available

And there are some interesting actions in that view too:

- A test session can be rerun
- A new test session can be created to rerun only the errors of the current run
- The test session can be stopped
- The results of a previously run test session can be seen again

And at last (but not least), the test runner can now be configured, so, one can use the test runner bundled in Pydev, Nose or Py.Test.

The preferences page to configure it can be accessed in the 'Configure test runner preferences' in the PyUnit view.



Anonymous said...

Thanks! I find this PyDev integration with unittest to be very useful !!!

Anonymous said...

Thank you Fabio for all your effort. Coming from .Net world and just moving to Python and seeing that I can get the same environment (decent IDE + unit testing ) I use in .Net is very encouraging and makes the language even more popular. Please keep all the good features going. Happy new year !

Mikko Korpela said...

Thank you!

New unit testing features are great!

Hope you get the real release out soon.

Anonymous said...

This has been great, as I've been using PyDev to learn TDD in general. My question though (and I googled unsuccessfully to see if an answer was already out there) is whether there's a way to run all tests. For example, I have a TestClass1 module with 10 test cases in it, and PyUnit works great to show me that 10/10 cases are passing (or whatever). But I also have a TestClass2 module with 10 different cases in it, and have to separately nagivate to it, and run it as a unittest. I'd like to do one run and see 20/20, etc.
Possible? Already there, and I've missed it?

Fabio Zadrozny said...

It's possible, just right click the modules (or packages) and choose run as > Python unittest.