File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
python_files/unittestadapter Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ def discover_tests(
57
57
}
58
58
"""
59
59
cwd = os .path .abspath (start_dir )
60
+ if "/" in start_dir : # is a subdir
61
+ parent_dir = os .path .dirname (start_dir )
62
+ sys .path .insert (0 , parent_dir )
63
+ else :
64
+ sys .path .insert (0 , cwd )
60
65
payload : DiscoveryPayloadDict = {"cwd" : cwd , "status" : "success" , "tests" : None }
61
66
tests = None
62
67
error : List [str ] = []
Original file line number Diff line number Diff line change @@ -195,6 +195,11 @@ def run_tests(
195
195
locals : Optional [bool ] = None ,
196
196
) -> ExecutionPayloadDict :
197
197
cwd = os .path .abspath (start_dir )
198
+ if "/" in start_dir : # is a subdir
199
+ parent_dir = os .path .dirname (start_dir )
200
+ sys .path .insert (0 , parent_dir )
201
+ else :
202
+ sys .path .insert (0 , cwd )
198
203
status = TestExecutionStatus .error
199
204
error = None
200
205
payload : ExecutionPayloadDict = {"cwd" : cwd , "status" : status , "result" : None }
You can’t perform that action at this time.
0 commit comments