1

I am running tests from a script with Nose. I want to be able to specify the xunit xml output file. The documentation says I can do it with the --xunit-file=FILE option.

I have

noseargs = ['--with-xunit', '--xunit-file=output.xml', '--tests=mytest']
nose.run(argv=noseargs)

After running this, the output.xml file isn't there. I've found if I swap the two arguments so it looks like:

noseargs = ['--xunit-file=output.xml', '--with-xunit', '--tests=mytest']
nose.run(argv=noseargs)

it will create a nosetests.xml file in my working directory. So it looks like the --with-xunit argument needs to be processed first, then the file needs to be specified. Is there something particular about how the file should be specified that I'm missing?

1 Answer 1

4

Nose eats the first argument of argv because on the commandline it's the name of the program.

This works with:

noseargs = ['foo', '--with-xunit', '--xunit-file=output.xml', '--tests=mytest']
nose.run(argv=noseargs)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.