|
19 | 19 | import py
|
20 | 20 |
|
21 | 21 | import pytest
|
| 22 | +from _pytest import deprecated |
22 | 23 | from _pytest import nodes
|
23 | 24 | from _pytest.config import filename_arg
|
| 25 | +from _pytest.warnings import _issue_warning_captured |
24 | 26 |
|
25 | 27 |
|
26 | 28 | class Junit(py.xml.Namespace):
|
@@ -421,23 +423,25 @@ def pytest_addoption(parser):
|
421 | 423 | default="total",
|
422 | 424 | ) # choices=['total', 'call'])
|
423 | 425 | parser.addini(
|
424 |
| - "junit_family", |
425 |
| - "Emit XML for schema: one of legacy|xunit1|xunit2", |
426 |
| - default="xunit1", |
| 426 | + "junit_family", "Emit XML for schema: one of legacy|xunit1|xunit2", default=None |
427 | 427 | )
|
428 | 428 |
|
429 | 429 |
|
430 | 430 | def pytest_configure(config):
|
431 | 431 | xmlpath = config.option.xmlpath
|
432 | 432 | # prevent opening xmllog on slave nodes (xdist)
|
433 | 433 | if xmlpath and not hasattr(config, "slaveinput"):
|
| 434 | + junit_family = config.getini("junit_family") |
| 435 | + if not junit_family: |
| 436 | + _issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2) |
| 437 | + junit_family = "xunit1" |
434 | 438 | config._xml = LogXML(
|
435 | 439 | xmlpath,
|
436 | 440 | config.option.junitprefix,
|
437 | 441 | config.getini("junit_suite_name"),
|
438 | 442 | config.getini("junit_logging"),
|
439 | 443 | config.getini("junit_duration_report"),
|
440 |
| - config.getini("junit_family"), |
| 444 | + junit_family, |
441 | 445 | config.getini("junit_log_passing_tests"),
|
442 | 446 | )
|
443 | 447 | config.pluginmanager.register(config._xml)
|
|
0 commit comments