This is likely a beginners mistake, or something of the like.
UPDATE
I installed nose instead of nose2, and ran nosetests --with-xunit
and it did exactly what I wanted, proving that the issue is not with my code but with how I am handling nose2. I would still like to know how I can achieve the same thing with nose2, as it seems that nose2 will eventually phase out nose and I would prefer to convert sooner rather than later.
Current Setup
I am currently running nose2, which finds and goes though all of my Python 3.6 unit tests and runs them. They are all currently passing. I am simply redirecting this output to file where I am able to open the text document and see the Ran X tests in Y.ZZZs
line, and it indicates that all my tests are passing.
Objective
I need to instead export this to some other format (currently trying the XML plugin) so that, at a later time, I can build a web interface. If not XML, perhaps HTML, or JSON, or YML, or something to that extent.
Attempted
- According to the (likely misinterpreted) docs, when invoked from the command line via
nose2 --plugin nose2.plugins.junitxml.JUnitXmlReporter
, I getModuleNotFoundError: No module named 'nose2.plugins.junitxml.JUnitXmlReporter'; 'nose2.plugins.junitxml' is not a package
nose2 --plugin nose2.plugins.junitxml
will run and pass all my tests but will not export the results to XML at my current location, home, or tests directory so I am assuming it is not at all.nose2 --config nose2.cfg
(Both I and the config are in my sources directory) will cause all the tests to fail do to failing to import any of the modules I have written (implying that it is successfully importing modules from interpreter, including ones I've pipped in so I'm assuming it is using the correct virtual environment.), but it will output these failures to XML at my current location. My configuration is as follows:[unittest] start-dir = . <-- My source directory, with "tests" as a sub of it plugins = nose2.plugins.junitxml code-directories = . tests/ [junit-xml] always-on = True path = nose2-junit.xml