File tree 2 files changed +8
-4
lines changed 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,14 @@ def _has_positional_arg(func):
49
49
50
50
51
51
def filter_traceback (entry ):
52
- # ensure entry.path is always a py.path.local object
52
+ # entry.path might sometimes return a str() object when the entry
53
+ # points to dynamically generated code
53
54
# see https://bitbucket.org/pytest-dev/py/issues/71
54
- path = py .path .local (entry .path )
55
- return path != cutdir1 and not path .relto (cutdir2 )
55
+ raw_filename = entry .frame .code .raw .co_filename
56
+ is_generated = '<' in raw_filename and '>' in raw_filename
57
+ if is_generated :
58
+ return False
59
+ return entry .path != cutdir1 and not entry .path .relto (cutdir2 )
56
60
57
61
58
62
def get_real_func (obj ):
Original file line number Diff line number Diff line change @@ -778,7 +778,7 @@ def test_filter_traceback_accepts_non_paths(self):
778
778
779
779
tb = py .code .Traceback (tb )
780
780
assert isinstance (tb [- 1 ].path , str ) # symptom of the py.code bug
781
- assert filter_traceback (tb [- 1 ])
781
+ assert not filter_traceback (tb [- 1 ])
782
782
783
783
784
784
class TestReportInfo :
You can’t perform that action at this time.
0 commit comments