From 379abfe8f8dad4dd9fc6e08fe056ae89f8427ed5 Mon Sep 17 00:00:00 2001 From: deng Date: Wed, 22 Jan 2025 15:29:52 +0800 Subject: [PATCH] vault backup: 2025-01-22 15:29:52 --- 組織/EverfortuneAI/{Note} Pytest.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/組織/EverfortuneAI/{Note} Pytest.md b/組織/EverfortuneAI/{Note} Pytest.md index 6c93fc3..a131af8 100644 --- a/組織/EverfortuneAI/{Note} Pytest.md +++ b/組織/EverfortuneAI/{Note} Pytest.md @@ -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)進行配置 \ No newline at end of file + - 善用[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)進行配置哦 \ No newline at end of file