Merge pull request #7980 from bluetech/code-changes

code: a few minor improvements
This commit is contained in:
Ran Benita
2020-11-01 09:51:39 +02:00
committed by GitHub
7 changed files with 89 additions and 70 deletions

View File

@@ -1648,7 +1648,7 @@ class Function(PyobjMixin, nodes.Item):
def _prunetraceback(self, excinfo: ExceptionInfo[BaseException]) -> None:
if hasattr(self, "_obj") and not self.config.getoption("fulltrace", False):
code = _pytest._code.Code(get_real_func(self.obj))
code = _pytest._code.Code.from_function(get_real_func(self.obj))
path, firstlineno = code.path, code.firstlineno
traceback = excinfo.traceback
ntraceback = traceback.cut(path=path, firstlineno=firstlineno)