Pytest: Documentation/errors: provide a forward-path for the --junitxml deprecation

Created on 23 Nov 2019  ·  9Comments  ·  Source: pytest-dev/pytest

With the deprecation of junitxml, we are only provided with a way to silence the warning, but no clear path to act on it in a way that isn't just kicking the can down the road. The deprecation warning should include a future-ready solution as well even if that's just a link to the external plugin or whatever.

junitxml easy reporting

Most helpful comment

Looks like the warning is defined here:

https://github.com/pytest-dev/pytest/blob/d1eb89d6940d3081876f663622017d8952e77a80/src/_pytest/deprecated.py#L38-L41

and used here:

https://github.com/pytest-dev/pytest/blob/d1eb89d6940d3081876f663622017d8952e77a80/src/_pytest/junitxml.py#L434-L437

I think it would be sufficient to expand the message:

JUNIT_XML_DEFAULT_FAMILY = PytestDeprecationWarning( 
    "You have not set the 'junit_family' config value, which currently defaults to 'xunit1'.\n" 
    "The 'junit_family' default value will change to 'xunit2' in pytest 6.0.\n" 
    "Add 'junit_family=legacy' (or another value) to your pytest.ini file to "
    "silence this warning and make your suite compatible." 
) 

All 9 comments

Ah… I've finally figure out that the warning is because I don't have this value set at all! I guess explicitly saying so in the error message would help?

Looks like the warning is defined here:

https://github.com/pytest-dev/pytest/blob/d1eb89d6940d3081876f663622017d8952e77a80/src/_pytest/deprecated.py#L38-L41

and used here:

https://github.com/pytest-dev/pytest/blob/d1eb89d6940d3081876f663622017d8952e77a80/src/_pytest/junitxml.py#L434-L437

I think it would be sufficient to expand the message:

JUNIT_XML_DEFAULT_FAMILY = PytestDeprecationWarning( 
    "You have not set the 'junit_family' config value, which currently defaults to 'xunit1'.\n" 
    "The 'junit_family' default value will change to 'xunit2' in pytest 6.0.\n" 
    "Add 'junit_family=legacy' (or another value) to your pytest.ini file to "
    "silence this warning and make your suite compatible." 
) 

Keeping this one open as IMO we should clarify the message, and it's a good intro-to-OSS issue 😄

@Zac-HD
As stated before GitHub failed me there - I am going through the issues that should not be closed.

Hi @Zac-HD ,

I think it would be sufficient to expand the message:

JUNIT_XML_DEFAULT_FAMILY = PytestDeprecationWarning( 
    "You have not set the 'junit_family' config value, which currently defaults to 'xunit1'.\n" 
    "The 'junit_family' default value will change to 'xunit2' in pytest 6.0.\n" 
    "Add 'junit_family=legacy' (or another value) to your pytest.ini file to "
    "silence this warning and make your suite compatible." 
) 

I'm not sure I follow the meaning of the message. What does "legacy (or another value)" mean? Shouldn't the recommendation be to explicitly set the current default? Ie. the last sentence whould read : « Add 'junit_family=xunit1' to your pytest.ini file to keep the current format in future versions of pytest and silence this warning ».

@fperrin I agree 👍

Also agree, I'd just made the minimal edit without thinking too much 😅

Thanks @nicoddemus

Was this page helpful?
0 / 5 - 0 ratings