- pytest Quick Start Guide
- Bruno Oliveira
- 126字
- 2021-07-16 17:51:29
Keyword expressions: -k
Often, you don't exactly remember the full path or name of a test that you want to execute. At other times, many tests in your suite follow a similar pattern and you want to execute all of them because you just refactored a sensitive area of the code.
By using the -k <EXPRESSION> flag (from keyword expression), you can run tests whose item id loosely matches the given expression:
λ pytest -k "test_parse"
This will execute all tests that contain the string parse in their item IDs. You can also write simple Python expressions using Boolean operators:
λ pytest -k "parse and not num"
This will execute all tests that contain parse but not num in their item IDs.
推薦閱讀
- 計算機網絡與通信(第2版)
- 廣電5G從入門到精通
- Building E-commerce Sites with VirtueMart Cookbook
- 5G承載網網絡規劃與組網設計
- 網絡安全技術與解決方案(修訂版)
- 物聯網時代
- 智慧光網絡:關鍵技術、應用實踐和未來演進
- 網絡安全應急響應技術實戰
- 搶占下一個智能風口:移動物聯網
- SAE原理與網絡規劃
- Learning Node.js Development
- Hands-On Microservices with Node.js
- Microsoft Power Platform Enterprise Architecture
- INSTANT LinkedIn Customization How-to
- 互聯網安全的40個智慧洞見(2016)