On PyDev 1.6.4, an improved unittest support was introduced. It allows using different test runners (the default PyDev test runner, nose or py.test) and allows seeing the results in a view (PyUnit view) with a red/green bar which also allows re-running tests.
The preferences page to configure the test runner is accessible from the PyUnit view at the dropdown menu > configure test runner preferences (or at window > preferences > PyDev > PyUnit)
Note: the flags to choose the tests in the test runner should not be specified (they are properly managed by PyDev in each test run)
The options that the PyDev unittest accepts are:
--verbosity=number
Sets the verbosity level for the run
HTMLTestRunner is an extension to the Python standard library's unittest module. It generates easy to use HTML test reports. See a sample report here. HTMLTestRunner is released under a BSD style license. 14 comments Download. HTMLTestRunner.py (0.8.2) testHTMLTestRunner.py test and demo of HTMLTestRunner.py. Return to my software. Source Code for Module unittests.HTMLTestRunner 1 ' 2 A TestRunner for use with the Python unit testing framework. It 3 generates a HTML report to show the result at a glance. 4 5 The simplest way to use this is to invoke its main method. 6 7 import unittest 8 import HTMLTestRunner 9 10. Define your tests. 11 12 if name 'main': 13.
Python Html Test Runner Online
--jobs=number
The number of processes to be used to run the tests
--split_jobs=tests|module
if tests is passed (default), the tests will be split independently to each process
if module is passed, a given job will always receive all the tests from a module
An example of options that can be set in the preferences would be:
--verbosity=1 --jobs=2 --split_jobs=module
Note: the integration was tested with version 1.0
The options that the nose test runner accepts can be found at http://nose.readthedocs.io
An example of options that can be set in the preferences would be:
--verbosity=2 --processes=2
--verbosity=2 (set the verbosity level to 2)
--processes=2 (use 2 processes to run the tests)
Note: the integration was tested with version 2.0
The options that the py.test test runner accepts can be found at http://pytest.org
An example of options that can be set in the preferences would be:
Html In Python
-maxfail=2 --tb=native
Python Unittest Html Report
-maxfail=2 (stop at 2nd failure)
--tb=native (will show tracebacks in the default standard library formatting)
Note: currently when using the xdist plugin, the results won't be properly shown in the PyUnit view.
The PyUnit view may be used to see the results of tests being run, their output, time, re-running tests, among others.
The most interesting features related to seeing the tests are:
- The results of tests are shown, along with a green/red bar depending whether all the tests succeeded or not (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 the most interesting actions are:
- 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
To show the results in the PyUnit view, a unittest run must be done. If running the tests when editing a module, Ctrl+F9 may be used to run the tests in that mode (and choosing which tests should be run), otherwise, right-click a folder or python file and choose Run as > Python Unittest