Skip to content
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

Cannot run tests with VS code with default configuration #2335

Closed
cidrblock opened this issue Aug 24, 2022 · 1 comment
Closed

Cannot run tests with VS code with default configuration #2335

cidrblock opened this issue Aug 24, 2022 · 1 comment
Assignees
Labels

Comments

@cidrblock
Copy link
Contributor

Summary

To run the tests using the VS code test tree, one of 2 configuration options needs to be added to the launch.json file within the .vscode directory.

Option 1:

Use the integratedTerminal which will have sourced the virtual environment prior to running `pytest'

{
            "name": "Python: Debug Tests",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "purpose": ["debug-test"],
            "console": "integratedTerminal",
            "justMyCode": false
}

Option 2

Prepend the virtual environment's bin directory to the system PATH:

{
            "name": "Python: Debug Tests",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "purpose": ["debug-test"],
            "env": {"PATH": "${workspaceFolder}/venv/bin"},
            "justMyCode": false
}

This will allow the ansible-config executable to be found in the current virtual environment.

This is not an ansible-lint issue, but a known issue with VS Code, here for tracking and linking purposes.

Feel free to close this, or possible we might add it to the dev docs:

Related: microsoft/vscode-python#4300

@cidrblock cidrblock added new Triage required bug labels Aug 24, 2022
@ssbarnea ssbarnea removed the new Triage required label Oct 1, 2022
@ssbarnea ssbarnea assigned audgirka and unassigned audgirka Oct 28, 2022
@audgirka
Copy link
Contributor

audgirka commented Feb 8, 2023

This seems to be fixed as we're able to see the tests in test explorer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants