我在 Python 的 pytest 中动态设置报告名称和文件夹时遇到问题。例如:我已经在 2020-03-06 21:50 运行了所有 pytest 的测试,所以我想将我的报告存储在20200306name 的文件夹中report_2150.html。我希望它在测试完成后立即自动化并触发。
我在 VS Code 中工作,我的目标是与没有自动化经验的同事分享我的工作,所以我的目标是将其用作“单击测试开始”。
我的项目结构:
webtools/
|?? .vscode/
|???? settings.json
|?? drivers/
|?? pages/
|?? reports/
|?? tests/
|???? __init__.py
|???? config.json
|???? conftest.py
|???? test_1.py
|???? test_2.py
|?? setup.py
Run Code Online (Sandbox Code Playgroud)
代码示例:
settings.json
webtools/
|?? .vscode/
|???? settings.json
|?? drivers/
|?? pages/
|?? reports/
|?? tests/
|???? __init__.py
|???? config.json
|???? conftest.py
|???? test_1.py
|???? test_2.py
|?? setup.py
Run Code Online (Sandbox Code Playgroud)
config.json
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true, …Run Code Online (Sandbox Code Playgroud)