-
Notifications
You must be signed in to change notification settings - Fork 1.2k
"Test framework pytest is not installed. Install?" even though it *is* installed. #5919
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
Comments
I've marked this as a regression, as I'm sure this wasn't a problem before. |
Here's the output from the "Python Test Log" Output panel:
|
Per @DonJayamanne, this is because the extension looks for "ModuleNotFoundError" (or "ImportError"?) in the output to decide if pytest is installed or not. Apparently that is too naive. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I confirm ericsnowcurrently's diagnosis. I wasted full working day installing-reinstalling-purging-installing again pytest, python, conda, vscode... I just had bad luck in that my test was failing because of the missing module... Please note, that my "bad luck" is actually a very probable scenario caused by another usability problem: when you write a unit test in |
Prescribed Solution
if (isNotInstalledError(reason as Error) && !quietMode) {
this.installer.promptToInstall(this.product, this.workspaceFolder)
.catch(ex => traceError('isNotInstalledError', ex));
} Check whether the module is installed using the code |
I've verified that the extension no longer says pytest isn't installed (even though it is). The text in "Python Test Log" output panel did not change (as expected). |
Uh oh!
There was an error while loading. Please reload this page.
I have a workspace with the following:
With the most recent insiders build of the extension I clicked on the "Discover Tests" button in the test explorer. A window popped up saying
Test framework pytest is not installed. Install?
I verified that pytest was indeed really installed for the current interpreter. Then I looked at the "Python Test Log" Output panel. It showed that pytest discovery had failed (due to a import errors in my test files).So when pytest discovery fails, the extension is erroneously acting as though pytest hasn't been installed yet.
Given that pytest discovered most of the tests, I would have expected those tests to show up in the test explorer. I would also have expected a warning to pop up saying that there was a failure during test discovery (with a button to open the "Python Test Log" panel).
The text was updated successfully, but these errors were encountered: