collective / collective.xmltestreport

Test runner which can output an XML report compatible with JUnit and Jenkins
https://pypi.org/project/collective.xmltestreport
7 stars 8 forks source link

Problems with zope.testrunner 6.3 #28

Open mauritsvanrees opened 8 months ago

mauritsvanrees commented 8 months ago

Some of the collective.xmltestreport code was merged into zope.testrunner 6.3. When I upgrade the Plone 6.0 core development buildout to use that version, I get an error:

$ bin/test -u
Traceback (most recent call last):
  File "/Users/maurits/community/plone-coredev/6.0/bin/test", line 297, in <module>
    import collective.xmltestreport.runner
  File "/Users/maurits/shared-eggs/cp311/collective.xmltestreport-2.0.2-py3.11.egg/collective/xmltestreport/runner.py", line 36, in <module>
    group.add_argument(
  File "/Users/maurits/.pyenv/versions/3.11.7/lib/python3.11/argparse.py", line 1468, in add_argument
    return self._add_action(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurits/.pyenv/versions/3.11.7/lib/python3.11/argparse.py", line 1670, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurits/.pyenv/versions/3.11.7/lib/python3.11/argparse.py", line 1482, in _add_action
    self._check_conflict(action)
  File "/Users/maurits/.pyenv/versions/3.11.7/lib/python3.11/argparse.py", line 1619, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/Users/maurits/.pyenv/versions/3.11.7/lib/python3.11/argparse.py", line 1628, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --xml: conflicting option string: --xml

The changelog for zope.testrunner provides a hint:

Add new –xml path option to write JUnit-like XML reports. Code comes from collective.xmltestreport, but be aware that here –xml is not a boolean, but expects a path!

It is not clear to me what to do though. Does collective.xmltestreport need an update? Should we stop using it, and use zope.testrunner directly? Do we need a change in tests.cfg?

Depending on the answer, it might be better to only do this in Plone 6.1, not 6.0.

davisagli commented 8 months ago

If I understand the change correctly, we should stop using collective.xmltestreport, and now pass --xml [path] where path is where we want the reports to go.

gforcada commented 8 months ago

Yes, all code from c.xmltestreport has been merged in zope.testrunner so we don't need it, we need to replace it with zc.recipe.testrunner and set a path for the --xml option.

As soon as we update plone/meta to use it as well, we can start getting junit reports in GitHub as well 🤩