Replace family "old" with "legacy"

This commit is contained in:
Joseph Hunkeler 2019-01-14 10:27:47 -05:00
parent 335cc5d651
commit 343430c537
No known key found for this signature in database
GPG Key ID: 5C1D2774D4689768
1 changed files with 17 additions and 9 deletions

View File

@ -78,14 +78,14 @@ def merge_family(left, right):
families = {} families = {}
families["_base"] = {"testcase": ["classname", "name"]} families["_base"] = {"testcase": ["classname", "name"]}
families["_base_old"] = {"testcase": ["file", "line", "url"]} families["_base_legacy"] = {"testcase": ["file", "line", "url"]}
# xUnit 1.x inherits old attributes # xUnit 1.x inherits legacy attributes
families["xunit1"] = families["_base"].copy() families["xunit1"] = families["_base"].copy()
merge_family(families["xunit1"], families["_base_old"]) merge_family(families["xunit1"], families["_base_legacy"])
# Alias "old" to xUnit 1.x # Alias "legacy" to xUnit 1.x
families["old"] = families["xunit1"] families["legacy"] = families["xunit1"]
# xUnit 2.x uses strict base attributes # xUnit 2.x uses strict base attributes
families["xunit2"] = families["_base"] families["xunit2"] = families["_base"]
@ -144,8 +144,8 @@ class _NodeReporter(object):
self.attrs = attrs self.attrs = attrs
self.attrs.update(existing_attrs) # restore any user-defined attributes self.attrs.update(existing_attrs) # restore any user-defined attributes
# Preserve old testcase behavior # Preserve legacy testcase behavior
if self.family == "old": if self.family == "legacy":
return return
# Purge attributes not permitted by this test family # Purge attributes not permitted by this test family
@ -354,7 +354,9 @@ def pytest_addoption(parser):
default="total", default="total",
) # choices=['total', 'call']) ) # choices=['total', 'call'])
parser.addini( parser.addini(
"junit_family", "Emit XML for schema: one of old|xunit1|xunit2", default="old" "junit_family",
"Emit XML for schema: one of legacy|xunit1|xunit2",
default="legacy",
) )
@ -397,7 +399,13 @@ def mangle_test_address(address):
class LogXML(object): class LogXML(object):
def __init__( def __init__(
self, logfile, prefix, suite_name="pytest", logging="no", report_duration="total", family="old" self,
logfile,
prefix,
suite_name="pytest",
logging="no",
report_duration="total",
family="legacy",
): ):
logfile = os.path.expanduser(os.path.expandvars(logfile)) logfile = os.path.expanduser(os.path.expandvars(logfile))
self.logfile = os.path.normpath(os.path.abspath(logfile)) self.logfile = os.path.normpath(os.path.abspath(logfile))