Skip to content

Commit

Permalink
Use same pytest --rootdir logic as test discovery (#17898)
Browse files Browse the repository at this point in the history
* Use same --rootdir logic as test discovery

* Add news entry
  • Loading branch information
bhrutledge authored Nov 8, 2021
1 parent 16335e2 commit d5f0dc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/2 Fixes/9553.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Partial fix for using the same directory as discovery when running tests.
(thanks [Brian Rutledge](https://github.com/bhrutledge))
2 changes: 1 addition & 1 deletion src/client/testing/testController/pytest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d5f0dc5

Please sign in to comment.