kondratyev-nv / vscode-python-test-adapter

Python Test Adapter for the VS Code Test Explorer
https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter
MIT License
117 stars 27 forks source link

incorrect test file paths when pytest.ini is in the parent of the workspace folder #257

Open ws1088 opened 3 years ago

ws1088 commented 3 years ago

if I add a folder with tests into a workspace and there is no pytest.ini in that folder and the pytest.ini is in the folder parent directory, test explorer will fail to display the source file and run the tests. Test discovery will work.

Workaround: add a symbolic link of the parent's pytest.ini to the folder will make it work.

FYI the vscode default testing pane/GUI works without the workaround.

ws1088 commented 3 years ago

image Example attached [bug.zip](https://github.com/kondratyev-nv/vscode-python-test-adapter/files/6706125/bug.zip) open bug.code-workspace and use pytest to discover the tests. try clicking the discovered test (by Python Test Explorer) and you will notice that it fail to open the file (test_me.py). Using the vscode default test GUI you can open the file.

Since the file path is incorrect, Python Test Explorer is not able to run the test (confirmed from the output window), while the vscode default GUI can run it with no issues.