[英]How do I run the test after completing all the tests? (
測試文件夾中有幾個測試: test_first.py , test_second.py 。 每個測試通過創建和修改項目來檢查站點的運行。 我需要它,無論我如何運行測試tests/test_first.py
或tests/
在完成所有測試后,都會執行delete_prj
函數,該函數會在測試運行后刪除創建的項目。 我不是要任務執行代碼,問題的答案就夠了
使用會話范圍的固定裝置。 像這樣的東西:
import pytest
@pytest.fixture(autouse=True, scope="session")
def do_stuff_after_everything_is_done():
yield
delete_prj()
(未經測試)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.