-
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
Add "Run Tests" to launch.json #11932
Comments
This comment was marked as outdated.
This comment was marked as outdated.
@ronif Ah! Just realized this is for "Run Tests" specifically. The previous comment applies specifically to debugging. We should make sure that if there is a test configuration in launch.json we should just run it under the debugger with |
Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision. |
Does this apply to the |
This feature will also allow one to use |
Continuing the previous comment: ... and will also allow one to set in a distinct configuration PYTEST_ADDOPTS for the coverage counting with custom arguments. Now the only option at least to enable coverage and do not break debugging exists. It is to add --no-cov to the debug configuration : https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings Some troubles connected with current approach:
|
So this is currently just working for test debugging, but not for just running the test with the Testing-Ribbon, right?
Do I have any other chance to set environment variables before running all tests with the Testing-Ribbon? I'm using Python with Pytest and can now debug tests with the Testing-Ribbon from VSCode, but the config seems not to be used when just running the test, without debugging. |
For run scenario, the best option would be set up all of the environment variables you need in a terminal and then launch VS code from there using We are currently working on improving the test adapter #17242, after that we should be in a better place to tackle these scenarios. |
Another solution I found, was just to add an python.envFile to the settings.json:
not ideal, because I guess that is now also setting/overwriting the envs for normal debugging, which I defined before in the launch.json file? |
In 2022, this appears to no longer function:
Pytest launches without any of these options added (and 10 processes are not created, verified with ps -ax) |
@boatcoder This is now changed a bit, try this:
|
|
what do I need to do for unittest? |
Our team are moving to vscode because of the dev-container support and this is the biggest sticking point they have when moving from pycharm - any update? |
My goal is to have a debugging session where I can use "debug test" from a test and be able to set breakpoints in library code. Adding the "purpose" option helps. However the behavior between regular debugging and with this is different. What am I missing here?
|
Hi,
Some of the tests (via unittest) I want to run locally require specific env variables. These tests also run in CI with different variables, so I would like to set them only locally in vscode. The "Debug Tests" launch.json feature allows me to do that, but only when debugging. I think a "Run Tests" option in launch.json would be really helpful for this.
The text was updated successfully, but these errors were encountered: