facebook / facebook/TestSlide

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

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted Python Unittest
Dominant language
Python
Stars
149
Forks
62
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.