[問題] Pytest問題
請問使用python的pytest測試框架, 如何將自訂的pytest指令參數值傳到每個test case檔案中pytest.mark.skipif的條件判斷使用?
EX: pytest --par=1, par的值用來判斷所有Test Case是否要Skip的依據
@pytest.mark.skipif(par > '1', reason='pass test1') --> 若par值大於 1 才skip測試案例
PS: 查了一些資料,看到用pytest.config方式取得值,但pytest版本目前使用6.X,pytest沒有config這個attribute
(ERROR MSG: AttributeError: module 'pytest' has no attribute 'config')
附上測試程式碼圖片
https://i.imgur.com/kqZmsc2.jpg
先感謝各位大大!
-----
Sent from JPTT on my iPhone
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.38.29.74 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1613815523.A.6E2.html
→
02/20 21:15,
3年前
, 1F
02/20 21:15, 1F
→
02/20 21:15,
3年前
, 2F
02/20 21:15, 2F
→
02/20 21:15,
3年前
, 3F
02/20 21:15, 3F
→
02/20 23:36,
3年前
, 4F
02/20 23:36, 4F
→
02/20 23:48,
3年前
, 5F
02/20 23:48, 5F
→
02/20 23:48,
3年前
, 6F
02/20 23:48, 6F
→
02/21 00:31,
3年前
, 7F
02/21 00:31, 7F
→
02/21 00:32,
3年前
, 8F
02/21 00:32, 8F
→
02/21 08:56,
3年前
, 9F
02/21 08:56, 9F