vault backup: 2025-01-22 15:29:52

This commit is contained in:
deng 2025-01-22 15:29:52 +08:00
parent 724d9f2f15
commit 379abfe8f8
1 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ tags:
- 透過``--cov``引數調用,例如``pytest --cov=./src ./tests``
- 專案越肥大通常測試會花上更多時間,搭配[Pytest-xdist](https://pytest-xdist.readthedocs.io/en/stable/distribution.html)插件可簡單地將測試平行化以節省寶貴時間
- 透過``-n``引數調用,例如``pytest -n auto``
- 善用pytest namespace可以將某些資料暫存給後續測試使用進一步節省測試時間
- 若測試物件之間有依賴性可使用xdist_group_mark將物件分群同群的物件將會被同一行程執行
- 若測試物件之間有依賴性可使用xdist_group_mark將物件分群同群的物件將會在同一行程內執行
- 平行化通常伴隨更多資源的消耗,使用時需小心~
- Pytest也支援[pyproject.toml](https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml)進行配置
- 善用[Fixture](https://docs.pytest.org/en/stable/explanation/fixtures.html#sharing-test-data)將某些資料暫存給後續測試使用,進一步節省測試時間
- Pytest也支援[pyproject.toml](https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml)進行配置哦