-
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
Using a different cwd and test path argument to pytest breaks test annotations #3029
Comments
Hi @Flamefire, thanks for the report! However, there are some details I'll need before I can track this down properly.
Thanks! |
What's the path to the python interpreter? I ask because of |
@d3r3kk The "bug" is here: https://github.com/Microsoft/vscode-python/blob/fbd9c444b83216233f935687262b910a30210be2/src/client/unittests/pytest/services/parserService.ts#L104 To reproduce:
I think the rest of the template is not relevant but I'll fill it out if you think otherwise @DonJayamanne No. This was just something we tried: In a mixed C++/Python source base put python packages in that folder which could then be installed directly. This was changed since though. Interpreter is default |
I see the issue, thanks for the extra info. I believe what would be needed here is to add more robust test discovery to the extension to allow this dissociation between tests and the modules they perform tests on. We are planning to add test-discovery functionality during the upcoming quarter, and we will cover scenarios such as this as we progress. Until then, the workaround would be to remove the use of CWD as you have it now. |
Note that a fix would be pretty easy. All that needs to be done is parse the line starting with "rootdir:" from pytest. All reported modules are relative to that. I'd probably be able to implement this but am unsure about the requirements for that (I guess at least appropriate test cases are required?) |
Yes, that may be the case, and do feel free to contribute of course! However, as I mentioned we are actually refactoring test discovery in the upcoming releases, so a fix would be temporary, and I'd hate for you to spend a lot of time on anything that wouldn't be around for very long.
Yep! Unit tests and all that great stuff.
|
Should be addressed via #16769 |
Relevant settings:
Debugging the extension I found that the tests path is converted relative to cwd but the test is relative to "${workspaceFolder}/test". This breaks the annotations.
The text was updated successfully, but these errors were encountered: