[wingide-users] problems with the command line unittest runner
support at wingware.com
Fri Aug 17 10:43:37 MDT 2012
Wingware Support wrote:
> Hmm, well, it took me quite a while of digging through source code to
> figure out how to get this to work at all and here is one example that
> does work, although without the --one-module-per-process option:
> python ~/src/ide/src/testing/runners/run_unittests_xml.py
> --output-file=test.xml -q test_textutils.CTextUtils.testQuotedSplit
> The key things are the -q option followed by
> modulename.classname.testName (not just testName by itself).
Note that you can omit the testName to run all tests in a class, and you
can omit the classname to run all tests in a module.
Also, --one-module-per-process does seem to work although the output
includes a spurious traceback that is actually ignored by Wing if you
import the results into the IDE with the Testing > Load Results menu
item. For example this worked for me:
--output-file=test.xml --one-module-per-process -q test_textutils
The presence of the exception in the XML is of course confusing. I
think we've not noticed this since it doesn't affect the outcome after
being imported into the IDE, and thus our unit tests for this
functionality are passing.
I've appended my corrected version of this docs page below, in case it
Thanks again for reporting these problems,
Wingware | Python IDE
Advancing Software Development
Wing's unittest test runner can be run from the command line and store
in an XML file that can be loaded into Wing via the ``Load Test
Results`` item in
the ``Testing`` menu. The test runner script is
``src/testing/runners/run_unittest_xml.py`` within the Wing installation
It should be run with the Python interpreter that should be used for the
selected tests as follows::
[options] -q testModule.className.testName
Where ``[options]`` is replaced with any of the command line options listed
below, ``testModule`` is the module name (without ``.py``), ``className`` is
the test class name, and ``testName`` is the name of the test to run. To run
all tests in a class, omit the ``testName``. To run all tests in a
also the ``className``.
Available command line options are:
* ``--directory=<dirname>``: Run in the given directory. Otherwise
runs in the
current directory inherited from the command line.
* ``--output-file=<filename>``: Write results to the selected file.
written to stdout if this option is not given.
* ``--append-to-file``: Append results to the file selected with the
* ``--one-module-per-process``: Run each module in a separate process.
* ``--pattern=<glob filename pattern>``: Run tests in each filename matching
the given glob pattern. This option may be repeated multiple times with
different glob patterns. It also turns on the
**Note:** Only the unittest test runner supports running from the
The doctest, nose, and Django test runners cannot be used this way.
More information about the wingide-users