-
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 discovery error #19809
Comments
@eleanorjboyd Lots of recent bugs are reported in pytest discovery, and you link to a feature-request that should solve this. |
@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! |
@eleanorjboyd Thanks for the heads up, that makes sense. I use pipenv, and will look for recent changes in pytest/pipenv. |
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 The resolution for me was to port I hope this comment may help anyone waiting for this issue to be resolved. |
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. |
@th0ger, interesting thank you. You are saying you have to include the setting |
@eleanorjboyd no, simply removing the following parts in
|
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) |
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 |
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! |
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 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
To override coverage options set in in Example TOML[tool.pytest.ini_options]
addopts = """
-p no:cacheprovider \
--cov proj.assets \
--cov-report term-missing \
--cov-report lcov:.coverage/.lcov \
--cov-fail-under 95"""
enable_assertion_pass_hook = true
python_files = "tests/*_test.py"
[tool.coverage.run]
branch = true
data_file = ".coverage/.coverage" |
Hi @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 |
Closing again as it has been inactive for a month but please reopen/ open a new issue if this persists. Thanks |
Type: Bug
error discovering pytest tests
Extension version: 2022.14.0
VS Code version: Code 1.70.2 (Universal) (e4503b30fc78200f846c62cf8091b76ff5547662, 2022-08-16T05:36:37.829Z)
OS version: Darwin arm64 21.5.0
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: