Skip to content

Commit d5f0dc5

Browse files
authored
Use same pytest --rootdir logic as test discovery (#17898)
* Use same --rootdir logic as test discovery * Add news entry
1 parent 16335e2 commit d5f0dc5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

news/2 Fixes/9553.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Partial fix for using the same directory as discovery when running tests.
2+
(thanks [Brian Rutledge](https://github.com/bhrutledge))

src/client/testing/testController/pytest/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class PytestRunner implements ITestsRunner {
8989
// if user has provided `--rootdir` then use that, otherwise add `cwd`
9090
if (testArgs.filter((a) => a.startsWith('--rootdir')).length === 0) {
9191
// Make sure root dir is set so pytest can find the relative paths
92-
testArgs.splice(0, 0, '--rootdir', options.workspaceFolder.fsPath);
92+
testArgs.splice(0, 0, '--rootdir', options.cwd);
9393
}
9494

9595
// Positional arguments control the tests to be run.

0 commit comments

Comments
 (0)