)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"038330ffa9d6c8ba6c736dacab360045eefcf3dd","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Stop using PlacementDirect"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"PlacementDirect was integrated into a functional test suite when it was"},{"line_number":10,"context_line":"first created as a way to prove that it worked and demonstrate how to"},{"line_number":11,"context_line":"use it."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"However, it was a pain then, because the interceptor needs to be created"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_57553a1c","line":10,"range":{"start_line":10,"start_character":23,"end_line":10,"end_character":46},"updated":"2019-03-11 15:29:39.000000000","message":"So do we have any test coverage for PlacementDirect anymore?","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dae62ba59cf5fa975ed4ece0ff537a0dbf441e8f","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Stop using PlacementDirect"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"PlacementDirect was integrated into a functional test suite when it was"},{"line_number":10,"context_line":"first created as a way to prove that it worked and demonstrate how to"},{"line_number":11,"context_line":"use it."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"However, it was a pain then, because the interceptor needs to be created"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_da814f4c","line":10,"range":{"start_line":10,"start_character":23,"end_line":10,"end_character":46},"in_reply_to":"5fc1f717_57553a1c","updated":"2019-03-11 15:34:45.000000000","message":"I pulled this down and no we don\u0027t have any testing of PlacementDirect now...which seems bad.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"61b874e66355c83f52bde65e161d38a17ab95c88","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Stop using PlacementDirect"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"PlacementDirect was integrated into a functional test suite when it was"},{"line_number":10,"context_line":"first created as a way to prove that it worked and demonstrate how to"},{"line_number":11,"context_line":"use it."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"However, it was a pain then, because the interceptor needs to be created"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_fd3765af","line":10,"range":{"start_line":10,"start_character":23,"end_line":10,"end_character":46},"in_reply_to":"5fc1f717_5a69df88","updated":"2019-03-11 16:27:17.000000000","message":"Yeah, the discussion around this was that PlacementDirect isn\u0027t actually being used by anything; and since it\u0027s being shown to be pretty brittle in its current state (see bug), we should quit trying to force it and back all the way off until someone somewhere demonstrates an actual desire for it. At that point we can fix it up (and introduce tests that are more oriented toward the use cases being asked for).\n\nI would remove PlacementDirect entirely from the nova incarnation of Placement, except that\u0027s \"frozen\".\n\nI suppose we could copy test_direct in from the placement repo if that would make you more comfortable (though that would also require a \"freeze exception\").","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"372c9935719c7f6c66db8e2371c539b2777672ae","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Stop using PlacementDirect"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"PlacementDirect was integrated into a functional test suite when it was"},{"line_number":10,"context_line":"first created as a way to prove that it worked and demonstrate how to"},{"line_number":11,"context_line":"use it."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"However, it was a pain then, because the interceptor needs to be created"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_5a69df88","line":10,"range":{"start_line":10,"start_character":23,"end_line":10,"end_character":46},"in_reply_to":"5fc1f717_da814f4c","updated":"2019-03-11 15:39:48.000000000","message":"There\u0027s functional/test_direct.py in placement itself, which \"proves it works\" in a general sort of way.\n\nBut also, the use case that drove the creation of PlacementDirect never materialized, so from nova\u0027s standpoint, whether it works or not isn\u0027t (currently) relevant. From the nova side there\u0027s nothing to test, right?\n\nIf somebody starts wanting to use it again, that\u0027s the point at which that service will want to start having tests of it. In the meantime, placement\u0027s test (assuming there are in fact sufficient) should suffice, no?","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0d8c36166477ddc4694986c8a526305e0789c358","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Stop using PlacementDirect"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"PlacementDirect was integrated into a functional test suite when it was"},{"line_number":10,"context_line":"first created as a way to prove that it worked and demonstrate how to"},{"line_number":11,"context_line":"use it."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"However, it was a pain then, because the interceptor needs to be created"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_3d93adfc","line":10,"range":{"start_line":10,"start_character":23,"end_line":10,"end_character":46},"in_reply_to":"5fc1f717_fd3765af","updated":"2019-03-11 16:41:23.000000000","message":"OK I didn\u0027t realize it was also in placement itself, then I care less about test coverage for it in nova since all of the other placement functional tests in nova have been removed.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"038330ffa9d6c8ba6c736dacab360045eefcf3dd","unresolved":false,"context_lines":[{"line_number":43,"context_line":"- Functional test suite test_resource_tracker.IronicResourceTrackerTest"},{"line_number":44,"context_line":"  was inheriting from the SchedulerReportClientTestBase class, but not"},{"line_number":45,"context_line":"  using the interceptor anywhere. Can\u0027t tell you why that was done. So"},{"line_number":46,"context_line":"  now it just uses the plain old test.TestBase like everyone else."},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"Change-Id: Icb889c09a69e7c5cbf9330e5d9917d6ab3ac3dc5"},{"line_number":49,"context_line":"Closes-Bug: #1818560"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_173572f7","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":46},"updated":"2019-03-11 15:29:39.000000000","message":"TestCase","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4fc4e41823982cb0ea1b219b830c63c0be9cc8be","unresolved":false,"context_lines":[{"line_number":43,"context_line":"- Functional test suite test_resource_tracker.IronicResourceTrackerTest"},{"line_number":44,"context_line":"  was inheriting from the SchedulerReportClientTestBase class, but not"},{"line_number":45,"context_line":"  using the interceptor anywhere. Can\u0027t tell you why that was done. So"},{"line_number":46,"context_line":"  now it just uses the plain old test.TestBase like everyone else."},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"Change-Id: Icb889c09a69e7c5cbf9330e5d9917d6ab3ac3dc5"},{"line_number":49,"context_line":"Closes-Bug: #1818560"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_b12266a3","line":46,"range":{"start_line":46,"start_character":38,"end_line":46,"end_character":46},"in_reply_to":"5fc1f717_173572f7","updated":"2019-03-11 19:36:18.000000000","message":"Done","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"038330ffa9d6c8ba6c736dacab360045eefcf3dd","unresolved":false,"context_lines":[{"line_number":46,"context_line":"  now it just uses the plain old test.TestBase like everyone else."},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"Change-Id: Icb889c09a69e7c5cbf9330e5d9917d6ab3ac3dc5"},{"line_number":49,"context_line":"Closes-Bug: #1818560"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_77607602","line":49,"range":{"start_line":49,"start_character":0,"end_line":49,"end_character":6},"updated":"2019-03-11 15:29:39.000000000","message":"This should be Related-Bug because this bug was already closed by Chris.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4fc4e41823982cb0ea1b219b830c63c0be9cc8be","unresolved":false,"context_lines":[{"line_number":46,"context_line":"  now it just uses the plain old test.TestBase like everyone else."},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"Change-Id: Icb889c09a69e7c5cbf9330e5d9917d6ab3ac3dc5"},{"line_number":49,"context_line":"Closes-Bug: #1818560"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5fc1f717_d125b2ac","line":49,"range":{"start_line":49,"start_character":0,"end_line":49,"end_character":6},"in_reply_to":"5fc1f717_77607602","updated":"2019-03-11 19:36:18.000000000","message":"Done","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"45893309b299c53ad90ba9e893090a1ec180afcf","unresolved":false,"context_lines":[{"line_number":15,"context_line":"diverging from in-tree placement, other problems started cropping up"},{"line_number":16,"context_line":"(see the associated bug)."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"So this commit removes the use of PlacementDirect from nova. Details:"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"- test_report_client now uses PlacementFixture. So all the `with"},{"line_number":21,"context_line":"  interceptor` context management is gone. This accounts for the vast"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5fc1f717_31ad1688","line":18,"range":{"start_line":18,"start_character":61,"end_line":18,"end_character":68},"updated":"2019-03-11 19:41:31.000000000","message":"Could have also mentioned that PlacementDirect is in the extracted placement repo and has testing there.","commit_id":"bcbc623868c2e7419e9dd6fff2dc12047553c494"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3c9491208dec67b9224c025fefed02d237c5c531","unresolved":false,"context_lines":[{"line_number":15,"context_line":"diverging from in-tree placement, other problems started cropping up"},{"line_number":16,"context_line":"(see the associated bug)."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"So this commit removes the use of PlacementDirect from nova. Details:"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"- test_report_client now uses PlacementFixture. So all the `with"},{"line_number":21,"context_line":"  interceptor` context management is gone. This accounts for the vast"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5fc1f717_4c7cc5b4","line":18,"range":{"start_line":18,"start_character":61,"end_line":18,"end_character":68},"in_reply_to":"5fc1f717_31ad1688","updated":"2019-03-11 21:05:58.000000000","message":"Done","commit_id":"bcbc623868c2e7419e9dd6fff2dc12047553c494"}],"nova/tests/functional/compute/test_resource_tracker.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"3d7ef92b349d351c98463f2de33d7b8cb9377381","unresolved":false,"context_lines":[{"line_number":34,"context_line":"DISK_GB \u003d orc.DISK_GB"},{"line_number":35,"context_line":"COMPUTE_HOST \u003d \u0027compute-host\u0027"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class IronicResourceTrackerTest(test_base.SchedulerReportClientTestBase):"},{"line_number":39,"context_line":"    \"\"\"Tests the behaviour of the resource tracker with regards to the"},{"line_number":40,"context_line":"    transitional period between adding support for custom resource classes in"},{"line_number":41,"context_line":"    the placement API and integrating inventory and allocation records for"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_f4002d03","side":"PARENT","line":38,"range":{"start_line":37,"start_character":0,"end_line":38,"end_character":71},"updated":"2019-03-04 22:49:41.000000000","message":"given that you have not neede to make any other change to this file seams to indicate that this was not actully doing anything useful.","commit_id":"c7db20d140eb0d3ccf0fd107eda7e80275bdd7d4"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"f11a79ae391b8404080007c608c11898f9f76ea5","unresolved":false,"context_lines":[{"line_number":34,"context_line":"DISK_GB \u003d orc.DISK_GB"},{"line_number":35,"context_line":"COMPUTE_HOST \u003d \u0027compute-host\u0027"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class IronicResourceTrackerTest(test_base.SchedulerReportClientTestBase):"},{"line_number":39,"context_line":"    \"\"\"Tests the behaviour of the resource tracker with regards to the"},{"line_number":40,"context_line":"    transitional period between adding support for custom resource classes in"},{"line_number":41,"context_line":"    the placement API and integrating inventory and allocation records for"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_14b5b132","side":"PARENT","line":38,"range":{"start_line":37,"start_character":0,"end_line":38,"end_character":71},"in_reply_to":"9fdfeff1_f4002d03","updated":"2019-03-04 22:59:15.000000000","message":"correct. I thought it would break when I took it out, but... :)","commit_id":"c7db20d140eb0d3ccf0fd107eda7e80275bdd7d4"}],"nova/tests/functional/test_report_client.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"29accc18e4cfa8fa12b1274900ea34b65cd47943","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"9fdfeff1_a0fd843c","updated":"2019-03-04 22:37:40.000000000","message":"Note to reviewers: You may want to look at this file with your \"Ignore Whitespace\" gerrit setting switched on.","commit_id":"6a8d73443c92f7751027da362d4fd043eeac3edf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0acf3ce9cfd1606b3e0bb2a16b59ddadf1c20260","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self.context \u003d context.get_admin_context()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        self.useFixture(func_fixtures.PlacementFixture())"},{"line_number":117,"context_line":"        self.client \u003d VersionCheckingReportClient()"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def test_client_report_smoke(self):"},{"line_number":120,"context_line":"        \"\"\"Check things go as expected when doing the right things.\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_5ab47f35","line":117,"range":{"start_line":117,"start_character":8,"end_line":117,"end_character":51},"updated":"2019-03-11 15:34:03.000000000","message":"I verified this still works by changing RESHAPER_VERSION to \u00271.31\u0027:\n\nnova.tests.functional.test_report_client.SchedulerReportClientTests.test_update_from_provider_tree_reshape\n----------------------------------------------------------------------------------------------------------\n\nCaptured traceback:\n~~~~~~~~~~~~~~~~~~~\n    Traceback (most recent call last):\n      File \"/home/osboxes/git/nova/.tox/functional/lib/python2.7/site-packages/mock/mock.py\", line 1305, in patched\n        return func(*args, **keywargs)\n      File \"nova/tests/functional/test_report_client.py\", line 1230, in test_update_from_provider_tree_reshape\n        allocations\u003dallocs)\n      File \"nova/scheduler/client/report.py\", line 1372, in update_from_provider_tree\n        allocations)\n      File \"nova/scheduler/client/report.py\", line 1253, in _set_up_and_do_reshape\n        self._reshape(context, inventories, allocations)\n      File \"nova/scheduler/client/report.py\", line 1221, in _reshape\n        raise exception.ReshapeFailed(error\u003dresp.text)\n    nova.exception.ReshapeFailed: Resource provider inventory and allocation data migration failed: {\"errors\": [{\"title\": \"Not Acceptable\", \"detail\": \"The resource could not be generated that was acceptable to your browser (content of type application/json. \\n\\n Invalid microversion: Unacceptable version header: 1.31\", \"status\": 406, \"request_id\": \"req-37861389-aefc-4908-8380-552aaae0760a\", \"max_version\": \"1.30\", \"min_version\": \"1.0\"}]}","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"61b874e66355c83f52bde65e161d38a17ab95c88","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        self.context \u003d context.get_admin_context()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        self.useFixture(func_fixtures.PlacementFixture())"},{"line_number":117,"context_line":"        self.client \u003d VersionCheckingReportClient()"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def test_client_report_smoke(self):"},{"line_number":120,"context_line":"        \"\"\"Check things go as expected when doing the right things.\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_fd4d2572","line":117,"range":{"start_line":117,"start_character":8,"end_line":117,"end_character":51},"in_reply_to":"5fc1f717_5ab47f35","updated":"2019-03-11 16:27:17.000000000","message":"That doesn\u0027t test VersionCheckingReportClient; you\u0027ve just bounced off of the maximum microversion at the server (1.30).\n\nThe way to verify this is to set nova.cmd.status.MIN_PLACEMENT_MICROVERSION to something lower than what\u0027s used in this file, e.g. 1.29, which errors like:\n\n      File \"nova/scheduler/client/report.py\", line 1253, in _set_up_and_do_reshape\n        self._reshape(context, inventories, allocations)\n      File \"nova/scheduler/client/report.py\", line 1219, in _reshape\n        global_request_id\u003dcontext.global_id)\n      File \"nova/tests/functional/test_report_client.py\", line 76, in post\n        self._check_microversion(kwargs)\n      File \"nova/tests/functional/test_report_client.py\", line 65, in _check_microversion\n        (microversion, status.MIN_PLACEMENT_MICROVERSION))\n    ValueError: Report client is using microversion 1.30, but nova.cmd.status is only requiring 1.29. See I4369f7fb1453e896864222fa407437982be8f6b5 for an example of how to bump the minimum requirement.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"038330ffa9d6c8ba6c736dacab360045eefcf3dd","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Do these with a failing request method to prove no API calls are made"},{"line_number":697,"context_line":"        with mock.patch.object(self.client._client, \u0027request\u0027,"},{"line_number":698,"context_line":"                               mock.NonCallableMock()):"},{"line_number":699,"context_line":"            # To begin with, the cache should be empty"},{"line_number":700,"context_line":"            self.assertEqual("},{"line_number":701,"context_line":"                [], self.client._provider_tree.get_provider_uuids())"}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_1a03570f","line":698,"range":{"start_line":698,"start_character":31,"end_line":698,"end_character":53},"updated":"2019-03-11 15:29:39.000000000","message":"Does this work or are we just getting lucky? I always use NonCallableMock as:\n\nwith mock.patch(..., new_callable\u003dmock.NonCallableMock())\n\nI could see how this works though since it\u0027s the \u0027new\u0027 argument and NonCallableMock is a Mock, it\u0027s just...non-callable.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"61b874e66355c83f52bde65e161d38a17ab95c88","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Do these with a failing request method to prove no API calls are made"},{"line_number":697,"context_line":"        with mock.patch.object(self.client._client, \u0027request\u0027,"},{"line_number":698,"context_line":"                               mock.NonCallableMock()):"},{"line_number":699,"context_line":"            # To begin with, the cache should be empty"},{"line_number":700,"context_line":"            self.assertEqual("},{"line_number":701,"context_line":"                [], self.client._provider_tree.get_provider_uuids())"}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_ddae2997","line":698,"range":{"start_line":698,"start_character":31,"end_line":698,"end_character":53},"in_reply_to":"5fc1f717_1a03570f","updated":"2019-03-11 16:27:17.000000000","message":"Well f me sideways.\n\nI wrapped L708 in this same cm and it... doesn\u0027t fail. Using the new_callable kwarg makes it hit.\n\nSo I updated this one to do the same and... it also fails.\n\nInvestigating.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3c9491208dec67b9224c025fefed02d237c5c531","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Do these with a failing request method to prove no API calls are made"},{"line_number":697,"context_line":"        with mock.patch.object(self.client._client, \u0027request\u0027,"},{"line_number":698,"context_line":"                               mock.NonCallableMock()):"},{"line_number":699,"context_line":"            # To begin with, the cache should be empty"},{"line_number":700,"context_line":"            self.assertEqual("},{"line_number":701,"context_line":"                [], self.client._provider_tree.get_provider_uuids())"}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_cc49958b","line":698,"range":{"start_line":698,"start_character":31,"end_line":698,"end_character":53},"in_reply_to":"5fc1f717_d19cd25e","updated":"2019-03-11 21:05:58.000000000","message":"This was good for me to remind myself how all that worked, though. Lead away.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"45893309b299c53ad90ba9e893090a1ec180afcf","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Do these with a failing request method to prove no API calls are made"},{"line_number":697,"context_line":"        with mock.patch.object(self.client._client, \u0027request\u0027,"},{"line_number":698,"context_line":"                               mock.NonCallableMock()):"},{"line_number":699,"context_line":"            # To begin with, the cache should be empty"},{"line_number":700,"context_line":"            self.assertEqual("},{"line_number":701,"context_line":"                [], self.client._provider_tree.get_provider_uuids())"}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_d19cd25e","line":698,"range":{"start_line":698,"start_character":31,"end_line":698,"end_character":53},"in_reply_to":"5fc1f717_d1e052fd","updated":"2019-03-11 19:41:31.000000000","message":"\u003e So in order get this to work the same way as new\u003dNonCallableMock(), you have to say: new_callable\u003dNonCallableMock\n\nYeah sorry in my example I should have removed the parenthesis and I know that you pass the type rather than an instance of the type, so maybe I led you astray for awhile.","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"4fc4e41823982cb0ea1b219b830c63c0be9cc8be","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Do these with a failing request method to prove no API calls are made"},{"line_number":697,"context_line":"        with mock.patch.object(self.client._client, \u0027request\u0027,"},{"line_number":698,"context_line":"                               mock.NonCallableMock()):"},{"line_number":699,"context_line":"            # To begin with, the cache should be empty"},{"line_number":700,"context_line":"            self.assertEqual("},{"line_number":701,"context_line":"                [], self.client._provider_tree.get_provider_uuids())"}],"source_content_type":"text/x-python","patch_set":3,"id":"5fc1f717_d1e052fd","line":698,"range":{"start_line":698,"start_character":31,"end_line":698,"end_character":53},"in_reply_to":"5fc1f717_ddae2997","updated":"2019-03-11 19:36:18.000000000","message":"Turns out this does work as expected - I was just mocking the wrong thing: I missed that PlacementFixture is creating its own Adapter [1] rather than using (or patching) the one from the report client.\n\nFor completeness:\n\n new_callable\u003dNonCallableMock()\n\nbreaks while it\u0027s actually doing the mocking - i.e. doesn\u0027t even get to the point where the mocked thing would be invoked. That\u0027s because the *value* of new_callable (in this case, the actual NonCallableMock instance) is *invoked* at *mock* time. It\u0027s typically used as a way to generate a mock dynamically.\n\nSo in order get this to work the same way as new\u003dNonCallableMock(), you have to say\n\n new_callable\u003dNonCallableMock\n\ni.e. without the parens.\n\nTL;DR: The value of \u0027new\u0027 is substituted for the mocked thing. The value of \u0027new_callable\u0027 is invoked, and the return value is substituted for the mocked thing.\n\n[1] https://github.com/openstack/nova/blob/a2d7ffba32585cce3da2212edc026be66d4ede66/nova/tests/functional/fixtures.py#L75","commit_id":"73fc1df5f21147835058a27efe00ca6596320610"}]}
