[wingide-users] problems with the command line unittest runner
pablo_adames at yahoo.com
Fri Aug 17 11:38:08 MDT 2012
Thanks, it worked in the old dual core laptop I have...
now I can justify getting a newer one for my python development.
I used a Windows Power Shell command line like this:
PS C:\Pablo\PIPEFLO-RegTest> python "C:\Program Files (x86)\Wing IDE 4.1\src\testing\runners\run_unittests_xml.py" --output-file=test.xml --one-module-per-process -q testXMLParsing
Running module C:\Program Files (x86)\Wing IDE 4.1\src\testing\runners\run_unittests_xml.py in C:\Pablo\PIPEFLO-RegTest
Running module testXMLParsing in C:\Pablo\PIPEFLO-RegTest
I found this more a documentation problem than anything.
I am surprised I did not see the exception using the above syntax and I could load the results easily...mmm
Are you guys using argparse for comamnd line parsing?
I think that argparse properly used could have avoided the problems I encountered.
My two cents and cheers to a great product I can't program without now!
Keep up the good work,
"If you think education is expensive, try ignorance." --Derek Bok
From: Wingware Support <support at wingware.com>
To: Pablo Adames <pablo_adames at yahoo.com>
Cc: Wing Users <wingide-users at wingware.com>
Sent: Friday, August 17, 2012 10:43 AM
Subject: Re: [wingide-users] problems with the command line unittest runner
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:
python ~/src/ide/src/testing/runners/run_unittests_xml.py --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 is useful.
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 results
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 directory.
It should be run with the Python interpreter that should be used for the
selected tests as follows::
/path/to/python /path/to/src/testing/runners/run_unittests_xml.py [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 module, omit
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. Results are
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 ``--one-process-per-module``
**Note:** Only the unittest test runner supports running from the command line.
The doctest, nose, and Django test runners cannot be used this way.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the wingide-users