Closed GoogleCodeExporter closed 9 years ago
See the note in the documentation:
Note that the decorators are applied from the bottom upwards. This is the
standard way that Python applies decorators. The order of the created mocks
passed into your test function matches this order.
Your "intuition" that decorators should be read top down is actually wrong I'm
afraid, and it would be odd if patch worked differently from "normal"
decorators. The arguments are passed in in the order that decorators are
applied.
Original comment by fuzzyman
on 30 Apr 2014 at 5:07
That's understandable but what I was trying to say is that this small change
wouldn't hurt anyone I think:
change `test(mock1, mock2)` to `test(mock2, mock1)`
it would just make it more obvious.
Original comment by radek.simko
on 30 Apr 2014 at 5:13
@patch.object(SomeClass, 'first_method') @patch.object(SomeClass, 'second_method') def test(second_method, first_method):
Original issue reported on code.google.com by
radek.simko
on 30 Apr 2014 at 10:32