使用 pytest 和 vscode-python 我想运行之前使用 unittest 框架实现的测试。
因此,我在相应的目录中使用 pytest 成功运行了测试tests。
pytest
Run Code Online (Sandbox Code Playgroud)
我还设置了 vscode-python 并成功测试了几乎所有测试。
但是,这些从子目录加载数据的测试tests/data会失败,因为 vscode-python 似乎从测试目录之外的另一个目录运行 pytest tests。
abc/
|-- tests/
|-- test_function.py
|-- data/
Run Code Online (Sandbox Code Playgroud)
如何设置 vscode-python,以便成功读取已实施的测试中的所有数据文件?