[issue27341] mock.patch decorator fails silently on generators

Shoshana Berleant report at bugs.python.org
Fri Jun 17 01:35:08 EDT 2016


New submission from Shoshana Berleant:

(at least in my case)

I committed two tests before I realized the tests were not being run: https://github.com/nipy/nipype/blob/abe7920a051f1570ccce4b71f26f50102d6e4e12/nipype/testing/tests/test_utils.py#L23

I realized this afternoon, while writing some more tests, that tests with the patch decorator were all reported as "OK", even when I wanted them to fail. Turns out they aren't being run at all.

I commented out all the yield statements, and the tests ran just as they should.

I don't know exactly what is going on here, but might raising an error or warning be good here?

Originally filed here: https://github.com/testing-cabal/mock/issues/366

----------
components: Tests
messages: 268709
nosy: shoshber
priority: normal
severity: normal
status: open
title: mock.patch decorator fails silently on generators
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27341>
_______________________________________


More information about the Python-bugs-list mailing list