Pra*_*ams 3 python pytest python-3.x python-unittest
我需要在整个测试套件运行后或在整个测试退出时执行命令。我在unittest中看到tearDownhook ,但在ruby中没有after-testsuite hook或类似的东西。at_exit
有什么方法我可以遵循吗unittest?pytest或对此进行任何调整
您可以在 pytest 中使用会话范围的固定装置。顾名思义,它使您可以在整个测试会话之前和之后运行代码:
\n@pytest.fixture(scope=\'session\', autouse=True)\ndef session_setup_teardown():\n # setup code goes here if needed\n yield\n cleanup_testsuite()\nRun Code Online (Sandbox Code Playgroud)\n你最好把这个装置放到顶层conftest.py.
我不知道 as\xc3\xadmilar 的功能unittest- 最接近的可能是tearDownModule每个测试模块执行一次。
| 归档时间: |
|
| 查看次数: |
908 次 |
| 最近记录: |