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
Hello! We are currently working on a rewrite of how we do pytest discovery/execution which will fix this issue. Here is the issue which outlines that work #17242 and the currently issue which is being worked on to prototype that functionality #19790.
Eleanor Boyd (@eleanorjboyd) Lots of recent bugs are reported in pytest discovery, and you link to a feature-request that should solve this.
For me, pytest discovery also used to work until recently. To me, this feels more like a regression.
Are you aware of any version introducing these errors?
Martin Thøgersen (@th0ger) are you using a conda environment? If so, there could be conda updates that could be affecting your dev environment. In general we have not made any changes to testing recently so there should not be any version updates that would have introduced these errors. Since pytest is also constantly pushing new versions it could be an issue with our integration as pytest makes changes so hopefully this re-write will fix the additional bugs. Thanks!
I ran into an issue that may be same as this one, and it's really a pain.
I have a directory A, containing submodules B and C, each containing also tests
A's configuration (in pytest.ini) even though pytest configuration does specify testpaths and norecursedirs
The resolution for me was to port pytest.ini's settings to pyproject.toml as we're handling our dependencies with poetry, but still it drove me mad to find this out.
I hope this comment may help anyone waiting for this issue to be resolved.
on .vscode to false and reload VScode, and them before trying to run the tests selected the proper python interpreted by using command pallete on python: select interpreter, and it worked properly.
So was pretty much wrong interpreted selected at VScode at the time I tried to run the tests on the extension (Also, Im using a conda environment)
Great glad that worked! We have also just begun rollout for a rewrite to our testing infrastructure. This might be a fix for anyone with ongoing issues in this thread so if you would like to test it and see if this bug is now resolved, here are the steps to do so!
To test you need to be on vscode insiders and then add this setting to your users settings.json"python.experiments.optInto": ["pythonTestAdapter"]. This is currently what is needed but we are in the process of switching all users to the rewrite but are doing so incrementally so if you do not have insiders, watch our release notes to get updated on when it will begin to hit stable. Thanks!
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Just in case it's useful to anyone, I have pyproject.toml in my test directory, and it seems that VS Code reads only some of this.
As you can see from the example below, I am outputting and LCOV report alongside the default coverage file. Both should be added to a directory called .coverage.
However, test discovery results in an error. I don't know for sure, but it seems as though test discovery is creating the default coverage file a ./.coverage, ignoring the table for [tool.coverage.run]. So every run of test discovery results in the following error.
Hi David Gard (@dgard1981)! Could you open another issue? Your problem seems more specific than the above conversation and I would love to discuss more with you about what the issue might be in your case. Thanks
Activity
eleanorjboyd commentedon Sep 12, 2022
Hello! We are currently working on a rewrite of how we do pytest discovery/execution which will fix this issue. Here is the issue which outlines that work #17242 and the currently issue which is being worked on to prototype that functionality #19790.
th0ger commentedon Oct 4, 2022
Eleanor Boyd (@eleanorjboyd) Lots of recent bugs are reported in pytest discovery, and you link to a feature-request that should solve this.
For me, pytest discovery also used to work until recently. To me, this feels more like a regression.
Are you aware of any version introducing these errors?
eleanorjboyd commentedon Oct 4, 2022
Martin Thøgersen (@th0ger) are you using a conda environment? If so, there could be conda updates that could be affecting your dev environment. In general we have not made any changes to testing recently so there should not be any version updates that would have introduced these errors. Since pytest is also constantly pushing new versions it could be an issue with our integration as pytest makes changes so hopefully this re-write will fix the additional bugs. Thanks!
th0ger commentedon Oct 4, 2022
Eleanor Boyd (@eleanorjboyd) Thanks for the heads up, that makes sense. I use pipenv, and will look for recent changes in pytest/pipenv.
lachaib commentedon Jan 11, 2023
I ran into an issue that may be same as this one, and it's really a pain.
I have a directory A, containing submodules B and C, each containing also tests
A's configuration (in pytest.ini) even though pytest configuration does specify
testpathsandnorecursedirsThe resolution for me was to port
pytest.ini's settings topyproject.tomlas we're handling our dependencies with poetry, but still it drove me mad to find this out.I hope this comment may help anyone waiting for this issue to be resolved.
th0ger commentedon Jan 11, 2023
FYI, I always get pytest discovery issues in vscode if coverage reports are enabled in pyproject. Disabling coverage has fixed it each and every time.
eleanorjboyd commentedon Jan 19, 2023
Martin Thøgersen (@th0ger), interesting thank you. You are saying you have to include the setting
--no-covfor it to work?th0ger commentedon Jan 19, 2023
Eleanor Boyd (@eleanorjboyd) no, simply removing the following parts in
setup.cfg:arlucio commentedon Jun 16, 2023
I changed
"python.testing.pytestEnabled": true
on .vscode to false and reload VScode, and them before trying to run the tests selected the proper python interpreted by using command pallete on python: select interpreter, and it worked properly.
So was pretty much wrong interpreted selected at VScode at the time I tried to run the tests on the extension (Also, Im using a conda environment)
eleanorjboyd commentedon Jun 23, 2023
Great glad that worked! We have also just begun rollout for a rewrite to our testing infrastructure. This might be a fix for anyone with ongoing issues in this thread so if you would like to test it and see if this bug is now resolved, here are the steps to do so!
To test you need to be on vscode insiders and then add this setting to your users
settings.json"python.experiments.optInto": ["pythonTestAdapter"]. This is currently what is needed but we are in the process of switching all users to the rewrite but are doing so incrementally so if you do not have insiders, watch our release notes to get updated on when it will begin to hit stable. Thanks!github-actions commentedon Jul 24, 2023
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!
dgard1981 commentedon Aug 4, 2023
Just in case it's useful to anyone, I have pyproject.toml in my test directory, and it seems that VS Code reads only some of this.
As you can see from the example below, I am outputting and LCOV report alongside the default coverage file. Both should be added to a directory called
.coverage.However, test discovery results in an error. I don't know for sure, but it seems as though test discovery is creating the default coverage file a
./.coverage, ignoring the table for[tool.coverage.run]. So every run of test discovery results in the following error.To override coverage options set in in
[tool.pytest.ini_options], I can add--no-covtopython.testing.pytestArgsin .vscode/settings.jsonExample TOML
eleanorjboyd commentedon Aug 4, 2023
Hi David Gard (@dgard1981)! Could you open another issue? Your problem seems more specific than the above conversation and I would love to discuss more with you about what the issue might be in your case. Thanks
eleanorjboyd commentedon Oct 4, 2023
Closing again as it has been inactive for a month but please reopen/ open a new issue if this persists. Thanks