Improve coverage for to_json() with paths in reports

This commit is contained in:
Bruno Oliveira
2019-03-25 19:19:59 -03:00
parent e4eec3416a
commit ceef0af1ae
2 changed files with 23 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ from _pytest._code.code import ReprLocals
from _pytest._code.code import ReprTraceback
from _pytest._code.code import TerminalRepr
from _pytest.outcomes import skip
from _pytest.pathlib import Path
def getslaveinfoline(node):
@@ -189,7 +190,7 @@ class BaseReport(object):
else:
d["longrepr"] = self.longrepr
for name in d:
if isinstance(d[name], py.path.local):
if isinstance(d[name], (py.path.local, Path)):
d[name] = str(d[name])
elif name == "result":
d[name] = None # for now