facebook/TestSlide

Focus & Skip broken for unittest.TestCase decorated by @patch

Open

#2 建立於 2018年10月3日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)Python (58 fork)auto 404
Python Unittestbughelp wanted

倉庫指標

Star
 (147 star)
PR 合併指標
 (PR 指標待抓取)

描述

For unittest.TestCase classes that are decorated with https://docs.python.org/3/library/unittest.mock.html#patch, when we do ftest or xtest, the decorator does to patch these methods, and we get a TypeError when running the test.

This happens because @patch is evaluated on the class loading, and it patches all methods there that begin with "test". Since ftest and xtest don't match the search, they're not decorated, and become broken.

貢獻者指南