Closed
Description
- Bitbucket: https://bitbucket.org/pytest-dev/py/issue/71
- Originally reported by: @nicoddemus
- Originally created at: 2015-09-30T03:16:42.939
Sometimes the path
attribute of a py.code.Code
object is not a py.local.path
object but a plain string, usually due to a traceback entry not being located in a real file but as a result of an exec statement.
import sys
def test_entry_not_path():
try:
ns = {}
exec('def foo(): raise ValueError', ns)
ns['foo']()
except ValueError:
_, _, tb = sys.exc_info()
tb = py.code.Traceback(tb)
assert isinstance(tb[-1].path, py.path.local)
This caused a regression in pytest, as seen in #995.
Metadata
Metadata
Assignees
Labels
No labels