You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discovery works but execution fails with file not found error #21640
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 Testing pane, I'm seeing tests successfully discovered, but if i try to run (or debug them), they automatically fail with a
ERROR: file or directory not found: <package/module/submodule_1/submodule_2/tests/test_file.py>
Our layout is a bit interesting, but at a high level it's something like
repo\
lib\
package\
The terminal spawns at repo, but I have an .env file with PYTHONPATH=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_blahblah
I'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.py works perfectly fine from terminal!
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.json to 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.
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
Thank 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.
Hello! Would people agree that #21632 has a minimal repro? I have tried this with version v2023.8.0 and 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.zip
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
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.
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
Activity
juandiago commentedon 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.inijuandiago commentedon Jul 15, 2023
flagging some similar issues over here:
#21637
#21632
[-]Execution works but discovery fails with file not found error[/-][+]Discovery works but execution fails with file not found error[/+]akarev0 commentedon Jul 17, 2023
juandiago downgraded extension version from 2023.12 to 2023.8 and I can verify that it works again, thanks :)
eleanorjboyd commentedon Jul 17, 2023
Thank 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.eleanorjboyd commentedon 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 zippath_issue.zip
juandiago commentedon Jul 17, 2023
Eleanor Boyd (@eleanorjboyd) some more data points:
pythonTestAdapter, allows me to use the Testing panel again, so it does seems related to thatrootdirchanges between the detection phase & the run phase of the test, resulting(I presume) on the file-not-found errorabadrinath15 commentedon Jul 17, 2023
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.
eleanorjboyd commentedon 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
23 remaining items
abadrinath15 commentedon Sep 11, 2023
Oh sorry! Undoing that.
akarev0 commentedon Sep 11, 2023
Aditya Badrinath (@abadrinath15) yeah, look fixed, sorry :)
abadrinath15 commentedon Sep 11, 2023
ok!
eleanorjboyd commentedon Oct 6, 2023
Hi, what is the status on this? Did people try it and it wasn't fixed?
abadrinath15 commentedon Oct 6, 2023
Hi Eleanor Boyd (@eleanorjboyd)! To my understanding it was fixed and that's why I closed it.
juandiago commentedon Oct 20, 2023
Can confirm resolved, everything green & working
Merged PR posit-dev/positron-python#213: Merge python extension relea…
Merged PR posit-dev/positron-python#213: Merge python extension relea…