Skip to content

"Test result not found" if cwd is a subdirectory in the workspace #18030

@adri0

Description

@adri0

VS Code version

1.62.2

Extension version

v2021.11.1422169775

OS type

macOS

OS version

10.15.7

Python distribution

python.org

Python version

Python 3.9.5

Language server

None or Disabled

Expected behaviour

Test results should show after running tests using Testing sidebar.

Actual behaviour

Exception raised after test finished running:

Test result not found for: ./tests/test_mod.py::test_1

Steps to reproduce

Structure of the repository that reproduces the issue:

.
├── .gitignore
├── README.md
├── backend
│   ├── .python-version
│   ├── Pipfile
│   ├── Pipfile.lock
│   ├── src
│   │   └── testmod
│   │       └── __init__.py
│   └── tests
│       ├── conftest.py
│       └── test_mod.py
└── test-pytest.code-workspace

I included in the repository the settings.json used. That shows:

{
    "python.defaultInterpreterPath": "/Users/adri0/.local/share/virtualenvs/backend-kdNxFSnI",
    "python.terminal.activateEnvironment": true,
    "python.terminal.activateEnvInCurrentTerminal": true,
    "python.testing.cwd": "${workspaceFolder}/backend",
    "python.testing.pytestEnabled": true,
    "python.testing.unittestEnabled": false,
    "python.testing.pytestArgs": [
        "tests/"
    ]
}

I noticed that if I change the cwd to ${workspaceFolder} and move the tests folder to the repository root, it works.

Logs

cwd: ~/code/test-pytest-clone/backend
> ~/.local/share/virtualenvs/backend-kdNxFSnI/bin/python ~/.vscode/extensions/ms-python.python-2021.11.1422169775/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/code/test-pytest-clone/backend -s --cache-clear tests/

Code of Conduct

  • I agree to follow this project's Code of Conduct

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