Friday, June 24, 2016

PyDev 5.1.2: pytest integration

PyDev 5.1.2 is now out. The major change is in the pytest integration.

For those that don't know about it, pytest ( is a Python test framework which requires less scaffolding to make tests (you don't need a hierarchy such as in PyUnit, just test methods in a module and asserts for checks suffice, it takes care of providing a reasonable error message -- also, it has an interesting fixture concept which allows structuring the test environment in a way more natural then through an inheritance hierarchy with unittest.TestCase.setUp/tearDown).

If you want to use pytest, in PyDev, the runner in the preferences > PyDev > PyUnit has to be set as pytest.

It's interesting to note that PyDev makes it trivial to just run a single test: you can select the test by using the method navigation (Ctrl+Shift+Up and Ctrl+Shift+Down) and press Ctrl+F9: this will open the outline for selecting which tests to run with only that test selected by default, then you can press Enter to run the test (or Shift+Enter to debug it) -- note that this works with the regular unittest too, not only with pytest.


Jonas said...

Great work Fabio! I appreciate the effort on which so many depend upon!

Unknown said...

I updated pydev to 5.1.2 on eclipse luna. Now my pydev debugger won't show variables in the or breakpoints in the debug perspective. Any idea on how to get them back? I have a slightly different install, since I use ArcGIS/arcpy, with a python interpreter installed from an ArcGIS location. Have any ideas I can try? Great job with pydev though, I use it daily. Thanks ahead of time - Chris.