有沒有辦法將 pytest 指向不同的 pytest.ini 文件?我正在處理的應(yīng)用程序有一個(gè) pytest.ini 文件,用于在啟動(dòng)時(shí)運(yùn)行單元測(cè)試,我不想修改該文件。但是,在通過 pytest.main() 運(yùn)行我的自動(dòng)化測(cè)試時(shí),我確實(shí)想將 pytest 指向不同的文件pytest.main(['-p', 'no:django', '-v', '--json-report', '-m', test_marker])有沒有辦法告訴 pytest 使用另一個(gè)位置的 pytest.ini 文件?
1 回答

侃侃無極
TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
$ pytest --help | grep -F config
-c file load configuration from `file` instead of trying to
locate one of the implicit configuration files.
那是,
pytest.main(['-c', 'pytest-alt.ini'])
添加回答
舉報(bào)
0/150
提交
取消