isagalaev ("Ivan Sagalaev :flag_wbw:") wrote:
#Python gotcha of the day: in unittest, `patch` decorators on a test class override those on its methods. It becomes obvious when you think how are they applied, but you intuitively expect and want the method ones to be more specific and override the more general class patching.
One workaround is to use `patch` via a `with` inside a method, which is going to run later then the class decorator. Any other ideas?