Using Nose & NoseXUnit on a Python package

2019-06-27 12:49发布

问题:

This is a previous post detailing a CI setup for Python. The asker and answerer detail the use of Nose and NoseXUnit with Hudson for their builds. However, NoseXUnit throws an error when run on any source folder where init.py is present:

File "build/bdist.linux-x86_64/egg/nosexunit/tools.py", line 59, 
    in packages nosexunit.excepts.ToolError: following folder can not contain 
    __init__.py file: /home/dev/source/web2py/applications

I can't think of a source folder of mine that is not a package also. Is there a step I am missing when dealing with NoseXUnit?

回答1:

You probably shouldn't use NoseXUnit - it's really out of date, and a similar feature exists in nose >= 0.11.

From nose --help:

  --with-xunit          Enable plugin Xunit: This plugin provides test results
                        in the standard XUnit XML format. [NOSE_WITH_XUNIT]
  --xunit-file=FILE     Path to xml file to store the xunit report in. Default
                        is nosetests.xml in the working directory
                        [NOSE_XUNIT_FILE]

if for some reason you need an old version of nose, use http://bitbucket.org/durin42/nose-xml/ - that's the plugin that became the --with-xunit option.