小编Sun*_*mar的帖子

如何访问 conftest.py 中的 json 文件(测试数据,如 config.json)

假设在这个例子中,如何config.jsonconftest使用pytest.

$ pwd
/home/user/repo/main
$ pytest  testcases/project_(1/2)/test_suite_(1/2).py
Run Code Online (Sandbox Code Playgroud)

目录结构:

??? main
?  ??? conftest.py  # conftest file for my fixtures
?  ??? testcases     
?     ??? project_1
?     ?   (contains these files --  test_suite_1.py, config.json)
?     ??? project_2
?         (contains these files -- test_suite_2.py, config.json)
??? workflows
?  ??? libs 
Run Code Online (Sandbox Code Playgroud)

python testing pytest

1
推荐指数
1
解决办法
4226
查看次数

标签 统计

pytest ×1

python ×1

testing ×1