File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,10 @@ def getlocation(function, curdir=None) -> str:
97
97
function = get_real_func (function )
98
98
fn = py .path .local (inspect .getfile (function ))
99
99
lineno = function .__code__ .co_firstlineno
100
- if curdir is not None and fn .relto (curdir ):
101
- fn = fn .relto (curdir )
100
+ if curdir is not None :
101
+ relfn = fn .relto (curdir )
102
+ if relfn :
103
+ return "%s:%d" % (relfn , lineno + 1 )
102
104
return "%s:%d" % (fn , lineno + 1 )
103
105
104
106
Original file line number Diff line number Diff line change @@ -121,7 +121,9 @@ def determine_setup(
121
121
sections = ["tool:pytest" , "pytest" ] if is_cfg_file else ["pytest" ]
122
122
for section in sections :
123
123
try :
124
- inicfg = iniconfig [section ]
124
+ inicfg = iniconfig [
125
+ section
126
+ ] # type: Optional[py.iniconfig._SectionWrapper]
125
127
if is_cfg_file and section == "pytest" and config is not None :
126
128
fail (
127
129
CFG_PYTEST_SECTION .format (filename = str (inifile )), pytrace = False
You can’t perform that action at this time.
0 commit comments