)]}'
{"nova/tests/spy.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"33ed3e06c497ea9d7c70c4569540188f6c9858a1","unresolved":false,"context_lines":[{"line_number":21,"context_line":"        if before:"},{"line_number":22,"context_line":"            before(_mock, *args, **kwargs)"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"        # NOTE(efried): This is a bit funky: simulate the behavior of the mock"},{"line_number":25,"context_line":"        # (track calls, call_count, etc.)."},{"line_number":26,"context_line":"        _mock(*args, **kwargs)"},{"line_number":27,"context_line":"        # And then actually call the original"},{"line_number":28,"context_line":"        res \u003d original(*args, **kwargs)"},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_40a14195","line":26,"range":{"start_line":24,"start_character":1,"end_line":26,"end_character":30},"updated":"2019-10-02 16:36:53.000000000","message":"interesting idea. :) \n\nIt is almost like everything we need. The caller can assert calls on the mock. But not transitively. Like _mock.return_value.another_call will not work as _mock.return_value never returned to the system under test so functions are never called on that.\n\nStill I think this allows the caller not to store call args manually in the before / after spy methods, but still assert them at the end. Which is good.\n\nI might not call this parameter a \u0027mock\u0027 as this cannot be used to change the behavior of the function we are spying on. E.g. setting _mock.return_value does not do anything.\n\nOn the other hand using _mock.side_effect in the before / after spy calls can effect the execution. E.g. _mock.side_effect\u003dValueError() will cause the the _spy() wrapper raise the ValueError at L26. This might what the author of the before / after wanted. So meh. \n\nI guess my only issue is that some things work on _mock (asserting calls, raising with the use of side_effect) while others (transitive calls, return_value) does not work. So wee need to document the behavior carefully.","commit_id":"986bce9cf3ddb24e31c01facb8423e1389322643"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"338c1c106f7e6335fc1ab52a8a2e6935f5df0019","unresolved":false,"context_lines":[{"line_number":21,"context_line":"        if before:"},{"line_number":22,"context_line":"            before(_mock, *args, **kwargs)"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"        # NOTE(efried): This is a bit funky: simulate the behavior of the mock"},{"line_number":25,"context_line":"        # (track calls, call_count, etc.)."},{"line_number":26,"context_line":"        _mock(*args, **kwargs)"},{"line_number":27,"context_line":"        # And then actually call the original"},{"line_number":28,"context_line":"        res \u003d original(*args, **kwargs)"},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_e8fdaf08","line":26,"range":{"start_line":24,"start_character":1,"end_line":26,"end_character":30},"in_reply_to":"3fa7e38b_40a14195","updated":"2019-10-02 21:31:12.000000000","message":"All good points, gibi. I\u0027ll rename and document accordingly.","commit_id":"986bce9cf3ddb24e31c01facb8423e1389322643"}],"nova/tests/unit/test_spy.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"35742e7f76281519010a2e5f86e050855c66f607","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"        # The tracker persists after the context manager closes. (Not that we"},{"line_number":125,"context_line":"        # should really ever need this behavior, but it matches what other"},{"line_number":126,"context_line":"        # context managers do.)"},{"line_number":127,"context_line":"        self.assertEqual(3, tracker.call_count)"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def test_spy_removed_after_exit(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_22e19ed1","line":126,"updated":"2019-10-03 09:39:33.000000000","message":"Thanks for documenting this","commit_id":"f231c27db1952293754fab00e65bd66fbc9f6327"}]}
