Issue a warning to prepare change of 'junit_family' default value
Fix #6179
This commit is contained in:
@@ -44,3 +44,32 @@ def test_external_plugins_integrated(testdir, plugin):
|
||||
|
||||
with pytest.warns(pytest.PytestConfigWarning):
|
||||
testdir.parseconfig("-p", plugin)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("junit_family", [None, "legacy", "xunit2"])
|
||||
def test_warn_about_imminent_junit_family_default_change(testdir, junit_family):
|
||||
"""Show a warning if junit_family is not defined and --junitxml is used (#6179)"""
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
def test_foo():
|
||||
pass
|
||||
"""
|
||||
)
|
||||
if junit_family:
|
||||
testdir.makeini(
|
||||
"""
|
||||
[pytest]
|
||||
junit_family={junit_family}
|
||||
""".format(
|
||||
junit_family=junit_family
|
||||
)
|
||||
)
|
||||
|
||||
result = testdir.runpytest("--junit-xml=foo.xml")
|
||||
warning_msg = (
|
||||
"*PytestDeprecationWarning: The 'junit_family' default value will change*"
|
||||
)
|
||||
if junit_family:
|
||||
result.stdout.no_fnmatch_line(warning_msg)
|
||||
else:
|
||||
result.stdout.fnmatch_lines([warning_msg])
|
||||
|
||||
Reference in New Issue
Block a user