-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use same pytest --rootdir
logic as test discovery
#17898
Conversation
--rootdir
logic as test discovery
--rootdir
logic as test discoverypytest --rootdir
logic as test discovery
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the logic below, this should use python.testing.cwd
if it's set, otherwise the --rootdir
option from python.testing.pytestArgs
.
vscode-python/src/client/testing/testController/pytest/pytestController.ts
Lines 288 to 299 in b6c0d3e
return this.runner.runTests( | |
testRun, | |
{ | |
workspaceFolder: workspace.uri, | |
cwd: | |
settings.testing.cwd && settings.testing.cwd.length > 0 | |
? settings.testing.cwd | |
: workspace.uri.fsPath, | |
token, | |
args: settings.testing.pytestArgs, | |
}, | |
this.idToRawData, |
@bhrutledge Can you provide a news file under
|
@bhrutledge Please sign the CLA so we can review and merge this. |
@karthiknadig Sorry for the delay on this; I haven't signed a CLA before, and was waiting on some advice. In the meantime, I've installed the VSIX locally and verified that it sets
Aside: I didn't find any documentation on how to use a VS Code extension while it's being developed, without manually installing the VSIX. I'm thinking of something equivalent to the "editable installs" provided via pip and setuptools. Is that possible? Can somebody point me in the right direction? Speaking of testing: I note that a check failed because this PR doesn't include TypeScript tests. However, it's not clear to me where to write such a test, and I note that #17509 didn't include tests. Any suggestions? |
@karthiknadig ICYMI, I've signed the CLA. |
@bhrutledge here are some instructions on how to build and run the extension during development. Build environments and compiling: https://github.com/microsoft/vscode-python/wiki/Coding There aren't any tests for this. I added this code as an intermediate step till we get to point of updating the pytest adapter. I think the test adapter that we currently use tries to do things that it should probably let pytest handle itself. We are currently in the process of re-doing the test adapters starting with the |
Thanks @karthiknadig. I had read over those, but they didn't answer my question; I've opened #17931 for assistance.
I'm interested in following this. Can you share some relevant links? For this PR, is there anything else you need from me? |
@karthiknadig Can you take another look at this? Looks like some checks are still pending; don't know why. |
This failing test doesn't seem related to this change: https://github.com/microsoft/vscode-python/runs/4143672875?check_suite_focus=true |
That is due to |
…-python#17898) * Use same --rootdir logic as test discovery * Add news entry
This is a quick submission via github.dev, so please pardon the lack of local testing and adherence to the contributing guidelines.
For #9553, specifically re: the second issue described in #9553 (comment).
FYI @karthiknadig, who touched this code in #17509.