-
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
Pytest tests are never discovered #22828
Comments
Hi! Could you send over your settings for the configuration of the tests? Also is that all the log messages you see? Usually there is something more following |
Hi Eleanor,
thank you for a quick response.
After clicking a couple more buttons I see those additional log lines
(still without any visible effect):
2024-02-01 19:41:01.956 [info] cwd: test
2024-02-02 11:11:13.920 [info] Discover tests for workspace name: eldak -
uri:
c:\Users\Aleksei_Lesnov\_work\projects\codility\eldak\.vscode\settings.json
2024-02-02 11:11:13.920 [info] Running discovery for pytest using the new
test adapter.
2024-02-02 11:11:14.640 [info] Discover tests for workspace name: eldak -
uri: c:\Users\Aleksei_Lesnov\_work\projects\codility\eldak
2024-02-02 11:11:14.640 [info] Running discovery for pytest using the new
test adapter.
2024-02-02 11:11:22.118 [info] Discover tests for workspace name: eldak -
uri: c:\Users\Aleksei_Lesnov\_work\projects\codility\eldak
2024-02-02 11:11:22.118 [info] Running discovery for pytest using the new
test adapter.
2024-02-02 11:11:24.606 [info] > ./.venv/Scripts/activate.bat && echo
'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-
python.python-2023.22.1/pythonFiles/printEnvVariables.py
2024-02-02 11:11:24.606 [info] shell: commandPrompt
2024-02-02 11:11:24.905 [info] > .\.venv\Scripts\python.exe -c "import
pytest"
The settings.json generated by the Pylance plugin is
{
"python.testing.pytestArgs": [
"attempt"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
I tried to add here
"python.analysis.logLevel": "Trace"
without any result. "Reload window" / "Clear cache and reload window"
doesn't help either.
Neither does uninstalling the plugin, removing the plugin traces from
.vsode folder and installing it back.
Could you please share some hints on debugging the extension? I'd really
like to solve the issue.
Regards,
Aleksei
чт, 1 февр. 2024 г. в 22:51, Eleanor Boyd ***@***.***>:
… Hi! Could you send over your settings for the configuration of the tests?
Also is that all the log messages you see? Usually there is something more
following 2024-02-01 19:41:01.956 [info] > ..venv\Scripts\python.exe -m
pytest -p vscode_pytest --collect-only attempt as that is just the call
to discover tests.
—
Reply to this email directly, view it on GitHub
<#22828 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUEIUDYZHS34KQE7UD2C43YRQE47AVCNFSM6AAAAABCVNDIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRSGMYTGNBQGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Can you try removing |
This is what the plugin adds in case the test folder is called "attempt".
Of course, I tried to remove it and it doesn't work.
Previously the test folder was called "test", and the plugin added "test"
which didn't work either.
пт, 2 февр. 2024 г. в 18:33, Eleanor Boyd ***@***.***>:
… Can you try removing attempt from the "python.testing.pytestArgs" and try
again? From my knowledge this isn't a valid arg for pytest and might be
causing and issue.
—
Reply to this email directly, view it on GitHub
<#22828 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUEIUH5E6C6PCPLXFPRFY3YRUPN7AVCNFSM6AAAAABCVNDIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRUGM3TCMZSGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Are you able to send over your test folder so I could take a look? Might help if I can try configuring it on my machine- thanks |
Here's the simplest example ever.
пт, 2 февр. 2024 г. в 18:46, Eleanor Boyd ***@***.***>:
… Are you able to send over your test folder so I could take a look? Might
help if I can try configuring it on my machine- thanks
—
Reply to this email directly, view it on GitHub
<#22828 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUEIUDI3LVDPFP2G2X54Y3YRUQ7RAVCNFSM6AAAAABCVNDIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRUGM4TOMJXG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Was surprised to see that my attachment has been lost on the way, |
I already forgot about this issue, switched from VSCode to PyCharm and removed the test project :) |
Hi! Glad the removal of the extra dot works! My apologies when I sent the command I meant to remove the I will check how we select the interpreter to use for the command but if you do have Ill get back to you about how we do interpreter selection and where exactly we find that path. Thanks |
Maybe I didn't explain it clearly, there's no progress from removing the
extra dot. Only that the command that you proposed, runs (and fails) - and
nothing else that moves me towards successful test discovery.
El mar, 2 abr 2024, 20:04, Eleanor Boyd ***@***.***> escribió:
… Hi! Glad the removal of the extra dot works! My apologies when I sent the
command I meant to remove the -m vscode_pytest since this is custom. We
use this module to collect the test results. We add the location of the
module to the path automatically so when you run through the UI it works
seemlessly.
I will check how we select the interpreter to use for the command but if
you do have ..venv\Scripts\python.exe in a config somewhere we are likely
finding that and selecting it so setting your interpreter path would be the
work around.
Ill get back to you about how we do interpreter selection and where
exactly we find that path. Thanks
—
Reply to this email directly, view it on GitHub
<#22828 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUEIUGT4ZKGOYTIZSNF3BLY3LXK5AVCNFSM6AAAAABCVNDIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZSG4YTINZXGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@karthiknadig, any idea how we are getting the wrong iterpreter? Seems we are selecting @alexpf if you are able to find anywhere in your settings that references |
No, there are no wrong references. I think you guys are in general moving in a wrong direction. Because whatever changes I made, nothing helped in discovering tests. I even dropped the whole idea of using VS Code, in favor of PyCharm which just works. |
Apologies for all the confusion! |
Environment data
Code Snippet
Create a project:
folder/
folder/requirements.txt with pytest
folder/test/
folder/test/test_attempt.py with one test, e.g.
def test_attempt():
pass
Repro Steps
Expected behavior
Tests discovered
Actual behavior
No tests discovered
Logs
The text was updated successfully, but these errors were encountered: