VS Code Test Explorer run button not working for tests in a Class

Viewed 30

When using Test Explorer in VS Code in a remote docker container (in MacOS Monterey M1), I am unable to run the individual tests that are within a Class from the buttons shown here:

screenshot of vscode with icons that appear when hovering over files in the sidebar circled

When I click on the Run Test button on the parent class (e.g. AppointmentAdminTest in the above image) it works just fine. The tests are included in the container through a volume pointed to my local file system.

Another oddity is clicking on the "Go To Test" button works for the class, but not the individual tests in the class. For example, in the screenshot, if I click on the "Go To Test" button for the AppointmentAdminTest class, it properly opens /code/tests/test_admin.py (/code/ is the mounted volume path in the docker container), but when I click on "Go To Test" for an individual test within a class, it tries to open the file at the local path (/Users/*my-username*/.../tests/test_admin.py)

My pytest configuration is as follows:

"python.testing.pytestArgs": [
    ".",
    "--no-cov",
    "-v",
    "-s",
    "--rootdir",
    "/code/"
]
0 Answers
Related