Skip to content

Debugging a test does not work in Testing tab #17399

Closed
@jzazo

Description

@jzazo

Environment data

  • VS Code version: 1.60.0
  • Extension version: v2021.9.1215971179
  • OS and version: Ubuntu 20.04
  • Python version: Python 3.8.5 (pyenv 1.2.21)
  • Type of virtual environment used: pipenv, version 2018.11.26
  • Relevant/affected Python packages and their versions: pytest 6.2.5
  • Relevant/affected Python-related VS Code extensions and their versions: workspace configuration
  • Value of the python.languageServer setting: Pylance

Expected behaviour

I hit the Testing tab to find tests and click on Debug Test button on any test. I expect the test to run.

Actual behaviour

The testing wheel keeps turning and the test is never ran / debugged, e.g., by placing a breakpoint.

Steps to reproduce:

I have a repo structure as follows:

somerepo/:
  example1/
    .vscode/
      settings.json
    src/python/example/
      __init__.py
      example.py
    test/python/test_example/
      __init__.py
      test_example.py
  somerepo.code-workspace
  .envrc
  Pipfile
  Pipfile.lock

The contents of somerepo.code-workspace are:

{
    "folders": [
        {"path": "."},
        {"path": "example1"}
    ],
    "settings": {
        "files.exclude":{
            "example1": true
        },
        "python.languageServer": "Pylance"
    }
}

The contents of example1/.vscode/settings.json are:

{
    "python.envFile": "${workspaceFolder}/.envrc",
    "python.analysis.extraPaths": ["./src/python"],
    "python.pythonPath": "/home/javier/.local/share/virtualenvs/example1-CvWCFCrt/bin/python",
    "python.testing.pytestArgs": ["test"],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
}

The contents of .envrc are:

layout pipenv

The contents of Pipfile are:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest = "*"

[packages]

[requires]
python_version = "3.8.5"

The contents of Pipfile.lock are generated by running pipenv install --dev.
The contents of example1/src/python/example/example.py are:

def hello():
    print("hello")

The contents of example1/test/python/example_test/test_example.py are:

def test_example1():
    assert True  # breakpoint here

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions