From 2215ea5015ad39815104b5f760c66fc91cbb71a0 Mon Sep 17 00:00:00 2001 From: Brian Rutledge Date: Tue, 2 Nov 2021 10:35:34 +0000 Subject: [PATCH 1/2] Use same --rootdir logic as test discovery --- src/client/testing/testController/pytest/runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/testing/testController/pytest/runner.ts b/src/client/testing/testController/pytest/runner.ts index f4ed5637e050..c74ec5745970 100644 --- a/src/client/testing/testController/pytest/runner.ts +++ b/src/client/testing/testController/pytest/runner.ts @@ -89,7 +89,7 @@ export class PytestRunner implements ITestsRunner { // if user has provided `--rootdir` then use that, otherwise add `cwd` if (testArgs.filter((a) => a.startsWith('--rootdir')).length === 0) { // Make sure root dir is set so pytest can find the relative paths - testArgs.splice(0, 0, '--rootdir', options.workspaceFolder.fsPath); + testArgs.splice(0, 0, '--rootdir', options.cwd); } // Positional arguments control the tests to be run. From 930f2747325d13e57800eb5ef9f2a7d07366f661 Mon Sep 17 00:00:00 2001 From: Brian Rutledge Date: Tue, 2 Nov 2021 11:56:05 -0400 Subject: [PATCH 2/2] Add news entry --- news/2 Fixes/9553.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/2 Fixes/9553.md diff --git a/news/2 Fixes/9553.md b/news/2 Fixes/9553.md new file mode 100644 index 000000000000..bffd265b0688 --- /dev/null +++ b/news/2 Fixes/9553.md @@ -0,0 +1,2 @@ +Partial fix for using the same directory as discovery when running tests. +(thanks [Brian Rutledge](https://github.com/bhrutledge))