Repository navigation
Discovery works but execution fails with file not found error #21640
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Jul 15, 2023 I can confirm this same issue on my end with versions above 2023.8.0, had to pin the extension version to 2023.8.0 on my
devcontainer.jsonto be able to work with the Testing panel again. Looks like a regression got introduced on releases after 2023.8.0.From early investigation, seems like pytest's rootdir is getting changed between the discovery phase and the run phase of the tests.
pytest.ini[pytest] DJANGO_SETTINGS_MODULE = app.settings pythonpath = . src env = ENV=test addopts = -v --color=yes -p no:warningsReacted by ringus1- changed the title
[-]Execution works but discovery fails with file not found error[/-][+]Discovery works but execution fails with file not found error[/+]on Jul 15, 2023 juandiago downgraded extension version from 2023.12 to 2023.8 and I can verify that it works again, thanks :)
Reacted by juandiago, Nathan LeRoy and samuelfeketeThank you for your issue report. We are looking into this now! In the meantime, you are likely on the new testing rewrite and this is why you saw a change in behavior since we just moved to this experiment to a larger group of people receiving it. You can opt out of the rewrite as I get this fix in by setting this in your user settings:
"python.experiments.optOutFrom": ["pythonTestAdapter"],. If this doesn't work let me know as this will mean it is a different issue. Thank you and I will send updates in this thread as I get a fix in.- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Jul 17, 2023 Hello! Would people agree that #21632 has a minimal repro? I have tried this with version
v2023.8.0and it is still not working for me. Can anyone provide any ideas on what might be going wrong? Here is my minimal repro as a zip
path_issue.zipEleanor Boyd (@eleanorjboyd) some more data points:
- Disabling the
pythonTestAdapter, allows me to use the Testing panel again, so it does seems related to that - The output I get on the console is not the same as test explorer cannot import .env #21632, I get a file-not-found error
- Checking the pytest conf on the test logs, the
rootdirchanges between the detection phase & the run phase of the test, resulting(I presume) on the file-not-found error
- Disabling the
abadrinath15 commented
on Jul 17, 2023 AuthorMore actionsEleanor Boyd (@eleanorjboyd) some more data points:
-
Disabling the
pythonTestAdapter, allows me to use the Testing panel again, so it does seems related to that -
The output I get on the console is not the same as test explorer cannot import .env #21632, I get a file-not-found error
-
Checking the pytest conf on the test logs, the rootdir changes between the detection phase & the run phase of the test, resulting(I presume) on the file-not-found error
I just wanted to hop-in and say my experience is the same as Juan Pablo Moreno G (@juan) on points 2/3, and I notice the rootdir thing as well. I unfortunately can't test 1 / the repro until later, but, rolling back to 2023.8 did work for me as well.
-
- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Jul 17, 2023 Using the zip below as a minimal repro and still not seeing it (sorry!). What is listed in your settings for the pytest args? Anything else I set up incorrectly? I appreciate all the help- thanks! path_changing.zip
- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Jul 17, 2023 23 remaining items
abadrinath15 commented
on Sep 11, 2023 AuthorMore actionsAditya Badrinath (@abadrinath15) not they not, it's still there
Oh sorry! Undoing that.
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Sep 11, 2023 Aditya Badrinath (@abadrinath15) yeah, look fixed, sorry :)
abadrinath15 commented
on Sep 11, 2023 AuthorMore actionsAditya Badrinath (@abadrinath15) yeah, look fixed, sorry :)
ok!
- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Sep 11, 2023 Hi, what is the status on this? Did people try it and it wasn't fixed?
- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Oct 6, 2023 abadrinath15 commented
on Oct 6, 2023 AuthorMore actionsHi Eleanor Boyd (@eleanorjboyd)! To my understanding it was fixed and that's why I closed it.
Reacted by Eleanor Boyd- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Oct 6, 2023 Can confirm resolved, everything green & working
Reacted by Eleanor Boyd- locked as resolved and limited conversation to collaborators
on Nov 20, 2023
Hello,
I didn't seem to have this problem before, but something seems to have gone a bit wonky this week (no changes to config on my end).
Using the vscode
Testingpane, I'm seeing tests successfully discovered, but if i try to run (or debug them), they automatically fail with aOur layout is a bit interesting, but at a high level it's something like
The terminal spawns at
repo, but I have an.envfile withPYTHONPATH=lib. All this seemed to have worked until say... Thursday? :) . Perhaps I had it setup wrong. In the debug output, I do see it now showing:Recieved JSON data: [package/module/submodule_1/submodule_2/tests/test_file.py::tests_blahblahI've never seen that
Received JSON line before; i do wonder if something on the paths is getting a little messed up from the latest version? Apologies for the mediocre output trace; trying to abstract it as much as I can. Let me know what else I could do to be helpful?I'm using v2023.12.0.
And of course running something like
pytest lib\package\module\submodule_1\submodule_2\tests\test_file.pyworks perfectly fine from terminal!Thanks.