)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"88efcc75fedf8909ca312e286c325b2c685e0f3e","unresolved":false,"context_lines":[{"line_number":40,"context_line":"required for accuracy."},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"It is the case that the functional tests seem a bit slower because"},{"line_number":43,"context_line":"of that additional db query."},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"Change-Id: I409a5e819a72d64e66ee390e4528da0c503d8d05"},{"line_number":46,"context_line":"Story: 2006232"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7faddb67_4c5d4513","line":43,"updated":"2019-07-17 17:56:30.000000000","message":"Actually I did some more poking, and this turns out to not be the case. I was seeing slower functional tests for some other reason. Switching back and forth between this and master I get the same approx 8-10s:\n\nRan: 1022 tests in 8.2245 sec.","commit_id":"7ec9df3d5fc1220efec7af12cdd9e5eddb955e95"}],"placement/objects/usage.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"05aa27977a48e3beae7fc6394d350f70162b662e","unresolved":false,"context_lines":[{"line_number":24,"context_line":"        self.resource_class \u003d resource_class"},{"line_number":25,"context_line":"        if resource_class_id is not None:"},{"line_number":26,"context_line":"            self.resource_class \u003d rc_cache.RC_CACHE.string_from_id("},{"line_number":27,"context_line":"                resource_class_id)"},{"line_number":28,"context_line":"        self.usage \u003d int(usage)"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_35760c40","side":"PARENT","line":27,"updated":"2019-07-17 22:44:37.000000000","message":"this seems like unrelated (but good) cleanup","commit_id":"3ba36fb7172ca8355fa29219bc8d0f0282cf834b"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"28c7b7a89d50ed8c56a4bd99991cc08055503da1","unresolved":false,"context_lines":[{"line_number":24,"context_line":"        self.resource_class \u003d resource_class"},{"line_number":25,"context_line":"        if resource_class_id is not None:"},{"line_number":26,"context_line":"            self.resource_class \u003d rc_cache.RC_CACHE.string_from_id("},{"line_number":27,"context_line":"                resource_class_id)"},{"line_number":28,"context_line":"        self.usage \u003d int(usage)"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_966ca3ce","side":"PARENT","line":27,"in_reply_to":"7faddb67_35760c40","updated":"2019-07-18 07:54:19.000000000","message":"It\u0027s related. This object doesn\u0027t have a context arg or member, which would be needed to access the cache here. So instead of adding context I found the lines (54 and 74) where resource_class_id is passed and did the translation there instead. And that removes the need for resource_class_id.","commit_id":"3ba36fb7172ca8355fa29219bc8d0f0282cf834b"}],"placement/resource_class_cache.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"05aa27977a48e3beae7fc6394d350f70162b662e","unresolved":false,"context_lines":[{"line_number":82,"context_line":"            return rc_id"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"        # Otherwise, check the database table"},{"line_number":85,"context_line":"        _refresh_from_db(self.ctx, self)"},{"line_number":86,"context_line":"        if rc_str in self.id_cache:"},{"line_number":87,"context_line":"            return self.id_cache[rc_str]"},{"line_number":88,"context_line":"        raise exception.ResourceClassNotFound(resource_class\u003drc_str)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_f564f44b","line":85,"range":{"start_line":85,"start_character":8,"end_line":85,"end_character":24},"updated":"2019-07-17 22:44:37.000000000","message":"ah, cool, we\u0027re already lazy-loading, ++","commit_id":"7ec9df3d5fc1220efec7af12cdd9e5eddb955e95"}],"placement/tests/unit/base.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"05aa27977a48e3beae7fc6394d350f70162b662e","unresolved":false,"context_lines":[{"line_number":22,"context_line":"    def setUp(self):"},{"line_number":23,"context_line":"        super(ContextTestCase, self).setUp()"},{"line_number":24,"context_line":"        self.useFixture("},{"line_number":25,"context_line":"            fixtures.MonkeyPatch(\u0027placement.resource_class_cache.ensure\u0027,"},{"line_number":26,"context_line":"                                 mock.MagicMock()))"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_15e3d0da","line":26,"range":{"start_line":25,"start_character":21,"end_line":26,"end_character":49},"updated":"2019-07-17 22:44:37.000000000","message":"Is the intent simply that invoking ensure() under this fixture will return a MagicMock? If so, this will work, but it\u0027s a bit circuitous. What you\u0027re doing by using MonkeyPatch is replacing the ensure method with the result of the second argument, i.e. the result of invoking mock.MagicMock(), which is a (different) MagicMock. Then when ensure() is invoked, it\u0027s invoking that (second) MagicMock - which will return yet a third MagicMock.\n\nIf you instead use MockPatch with return_value\u003dmock.MagicMock(), you\u0027ll only create the one MagicMock that\u0027ll be returned when you invoke ensure().\n\nFor that matter, you don\u0027t need MagicMock, as it\u0027s just a superset of Mock that has default magic methods, none of which you need. So you could just say:\n\n self.useFixture(fixtures.MockPatch(\u0027placement...ensure\u0027))\n\n(You\u0027ll get a regular Mock return_value by default)","commit_id":"7ec9df3d5fc1220efec7af12cdd9e5eddb955e95"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"28c7b7a89d50ed8c56a4bd99991cc08055503da1","unresolved":false,"context_lines":[{"line_number":22,"context_line":"    def setUp(self):"},{"line_number":23,"context_line":"        super(ContextTestCase, self).setUp()"},{"line_number":24,"context_line":"        self.useFixture("},{"line_number":25,"context_line":"            fixtures.MonkeyPatch(\u0027placement.resource_class_cache.ensure\u0027,"},{"line_number":26,"context_line":"                                 mock.MagicMock()))"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_16875364","line":26,"range":{"start_line":25,"start_character":21,"end_line":26,"end_character":49},"in_reply_to":"7faddb67_15e3d0da","updated":"2019-07-18 07:54:19.000000000","message":"Ah, thanks for the lesson. My awareness of the magic of mock is limited as mocks give me even more hives than returns within for loops.\n\nI\u0027ll fix this up.","commit_id":"7ec9df3d5fc1220efec7af12cdd9e5eddb955e95"}]}
