addCleanup vs tearDown

前端 未结 3 1529
有刺的猬
有刺的猬 2021-02-03 19:47

Recently, Ned Batchelder during his talk at PyCon 2016 noted:

If you are using unittest to write your tests, definitely use addCleanu

3条回答
  •  情话喂你
    2021-02-03 20:10

    addCleanup() methods will run even if one of them fails, and will run even if setUp() fails. You should also consider using pytest.

提交回复
热议问题