)]}'
{"nova/tests/unit/scheduler/test_chance_scheduler.py":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a0bb606d49bd3ed018690eb471a69fcdcca905c9","unresolved":false,"context_lines":[{"line_number":58,"context_line":"            return all_hosts"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        mock_random_choice.side_effect \u003d [\u0027host3\u0027, \u0027host2\u0027]"},{"line_number":61,"context_line":"        self.stub_out(\u0027nova.scheduler.chance.ChanceScheduler.hosts_up\u0027,"},{"line_number":62,"context_line":"                      _return_hosts)"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"        spec_obj \u003d objects.RequestSpec(num_instances\u003d2, ignore_hosts\u003dNone)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a5de9d1_b2acd28c","line":61,"range":{"start_line":61,"start_character":13,"end_line":61,"end_character":21},"updated":"2016-02-01 14:28:41.000000000","message":"well, you could have been using mock.patch for this one too, but fair enough.","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"13324bec3d028a385a1a4ff4f3c308afa781ee99","unresolved":false,"context_lines":[{"line_number":58,"context_line":"            return all_hosts"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        mock_random_choice.side_effect \u003d [\u0027host3\u0027, \u0027host2\u0027]"},{"line_number":61,"context_line":"        self.stub_out(\u0027nova.scheduler.chance.ChanceScheduler.hosts_up\u0027,"},{"line_number":62,"context_line":"                      _return_hosts)"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"        spec_obj \u003d objects.RequestSpec(num_instances\u003d2, ignore_hosts\u003dNone)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a5de9d1_db23a954","line":61,"range":{"start_line":61,"start_character":13,"end_line":61,"end_character":21},"in_reply_to":"7a5de9d1_b2acd28c","updated":"2016-02-01 16:00:13.000000000","message":"This is just me following the pattern of the other test (see _return_no_host) so that they are consistent. Had I been starting from scratch, I would have used mock.","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a0bb606d49bd3ed018690eb471a69fcdcca905c9","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        self.assertIsNone(node)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        calls \u003d [mock.call(all_hosts), mock.call(all_hosts)]"},{"line_number":76,"context_line":"        self.assertEqual(calls, mock_random_choice.call_args_list)"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def test_select_destinations_no_valid_host(self):"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"7a5de9d1_7263ba42","line":76,"updated":"2016-02-01 14:28:41.000000000","message":"that looks a cool additional assert, but IMHO it wasn\u0027t really needed for the method you were mocking unless you wanted to make 100% sure that you were calling twice random.choice() (which imho seems my nit)","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"13324bec3d028a385a1a4ff4f3c308afa781ee99","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        self.assertIsNone(node)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        calls \u003d [mock.call(all_hosts), mock.call(all_hosts)]"},{"line_number":76,"context_line":"        self.assertEqual(calls, mock_random_choice.call_args_list)"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def test_select_destinations_no_valid_host(self):"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"7a5de9d1_5b29f988","line":76,"in_reply_to":"7a5de9d1_7263ba42","updated":"2016-02-01 16:00:13.000000000","message":"I agree that we don\u0027t necessarily need to assert on all the mock calls. That said, some of the reviewers are asking for very literal mox to mock conversions \u0026 specifically request these assertions, so I\u0027ve been erring on the side of caution.\n\nIt also demonstrates that random is called with the all hosts each time too (questionably useful).","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"}],"nova/tests/unit/scheduler/test_filter_scheduler.py":[{"author":{"_account_id":5538,"name":"Rushi Agrawal","email":"rushi.openstack@gmail.com","username":"rushiagr"},"change_message_id":"5bd52e1a946fd6c87f4b011815549c408d89c45f","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            host_state \u003d hosts[0]"},{"line_number":60,"context_line":"            return [weights.WeighedHost(host_state, self.next_weight)]"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"        self.stubs.Set(self.driver.host_manager, \u0027get_filtered_hosts\u0027,"},{"line_number":63,"context_line":"                fake_get_filtered_hosts)"},{"line_number":64,"context_line":"        self.stub_out(\u0027nova.scheduler.weights.HostWeightHandler.\u0027"},{"line_number":65,"context_line":"                \u0027get_weighed_objects\u0027, _fake_weigh_objects)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_42878a61","line":62,"updated":"2016-01-20 16:41:14.000000000","message":"This and 5 more instances of stubs.Set in this file","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"13324bec3d028a385a1a4ff4f3c308afa781ee99","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            host_state \u003d hosts[0]"},{"line_number":60,"context_line":"            return [weights.WeighedHost(host_state, self.next_weight)]"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"        self.stubs.Set(self.driver.host_manager, \u0027get_filtered_hosts\u0027,"},{"line_number":63,"context_line":"                fake_get_filtered_hosts)"},{"line_number":64,"context_line":"        self.stub_out(\u0027nova.scheduler.weights.HostWeightHandler.\u0027"},{"line_number":65,"context_line":"                \u0027get_weighed_objects\u0027, _fake_weigh_objects)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a5de9d1_617c42ec","line":62,"in_reply_to":"7a5de9d1_400b4424","updated":"2016-02-01 16:00:13.000000000","message":"Good point! Fixed :)","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"a0bb606d49bd3ed018690eb471a69fcdcca905c9","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            host_state \u003d hosts[0]"},{"line_number":60,"context_line":"            return [weights.WeighedHost(host_state, self.next_weight)]"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"        self.stubs.Set(self.driver.host_manager, \u0027get_filtered_hosts\u0027,"},{"line_number":63,"context_line":"                fake_get_filtered_hosts)"},{"line_number":64,"context_line":"        self.stub_out(\u0027nova.scheduler.weights.HostWeightHandler.\u0027"},{"line_number":65,"context_line":"                \u0027get_weighed_objects\u0027, _fake_weigh_objects)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a5de9d1_400b4424","line":62,"in_reply_to":"9a68dd71_3c71c444","updated":"2016-02-01 14:28:41.000000000","message":"why not using mock.patch.object(myobject, mymethod, side_effect) then ?","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"e6b216e27d4d16330cb6b762f6ad79223f82b245","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            host_state \u003d hosts[0]"},{"line_number":60,"context_line":"            return [weights.WeighedHost(host_state, self.next_weight)]"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"        self.stubs.Set(self.driver.host_manager, \u0027get_filtered_hosts\u0027,"},{"line_number":63,"context_line":"                fake_get_filtered_hosts)"},{"line_number":64,"context_line":"        self.stub_out(\u0027nova.scheduler.weights.HostWeightHandler.\u0027"},{"line_number":65,"context_line":"                \u0027get_weighed_objects\u0027, _fake_weigh_objects)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_3c71c444","line":62,"in_reply_to":"9a68dd71_42878a61","updated":"2016-01-23 03:31:25.000000000","message":"Yup, I intentionally left those 5 hoping for a stub_out_object helper in the near future.","commit_id":"d1f4832fa76add25780ed8ea2942aecfe4fea0f9"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"36d6bdbb6bf2b0b5475367f3e8e038ad6afe8131","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        with mock.patch.object(self.driver.host_manager,"},{"line_number":79,"context_line":"                               \u0027get_filtered_hosts\u0027) as mock_get_hosts:"},{"line_number":80,"context_line":"            mock_get_hosts.side_effect \u003d fake_get_filtered_hosts"},{"line_number":81,"context_line":"            weighed_hosts \u003d self.driver._schedule(self.context, spec_obj)"},{"line_number":82,"context_line":"            self.assertEqual(len(weighed_hosts), 10)"},{"line_number":83,"context_line":"            for weighed_host in weighed_hosts:"},{"line_number":84,"context_line":"                self.assertIsNotNone(weighed_host.obj)"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_77539617","line":81,"updated":"2016-02-01 20:14:53.000000000","message":"for sake of clarity, could you please use the contextmanager just for calling the needed method and not for the asserts ?\n\nie. \n\n  with mock.patch.obj() as my_mock:\n    my_return \u003d my_method_I_want_to_check()\n  my_mock.assert_is_called_once_with()\n  self.assertEqual(expected, my_return)","commit_id":"a8ac201e319de218c0e5abf3886a1690f16f8f41"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"6f2aaf654e9b5c67ddee8555e45ea35843b010ba","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        with mock.patch.object(self.driver.host_manager,"},{"line_number":79,"context_line":"                               \u0027get_filtered_hosts\u0027) as mock_get_hosts:"},{"line_number":80,"context_line":"            mock_get_hosts.side_effect \u003d fake_get_filtered_hosts"},{"line_number":81,"context_line":"            weighed_hosts \u003d self.driver._schedule(self.context, spec_obj)"},{"line_number":82,"context_line":"            self.assertEqual(len(weighed_hosts), 10)"},{"line_number":83,"context_line":"            for weighed_host in weighed_hosts:"},{"line_number":84,"context_line":"                self.assertIsNotNone(weighed_host.obj)"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_501a0fc7","line":81,"in_reply_to":"7a5de9d1_77539617","updated":"2016-02-02 07:29:20.000000000","message":"Done","commit_id":"a8ac201e319de218c0e5abf3886a1690f16f8f41"}],"nova/tests/unit/scheduler/test_host_manager.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"6c09e1c05347986fd8eb97010989876c5846b570","unresolved":false,"context_lines":[{"line_number":440,"context_line":"            node \u003d compute_node[\u0027hypervisor_hostname\u0027]"},{"line_number":441,"context_line":"            state_key \u003d (host, node)"},{"line_number":442,"context_line":"            self.assertEqual(host_states_map[state_key].service,"},{"line_number":443,"context_line":"                obj_base.obj_to_primitive(fakes.get_service_by_host(host)))"},{"line_number":444,"context_line":""},{"line_number":445,"context_line":"        self.assertEqual(host_states_map[(\u0027host1\u0027, \u0027node1\u0027)].free_ram_mb,"},{"line_number":446,"context_line":"                         512)"}],"source_content_type":"text/x-python","patch_set":2,"id":"da6ed579_80a8e878","line":443,"updated":"2016-01-18 15:49:50.000000000","message":"Unrelated whitespace change. The preference for continued lines is to either indent 2 levels (8 spaces), or to visually line up the continued line.","commit_id":"8cb0a23f93b730611f754a8286536277a85c11da"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"dc42bd018b207c86ca27d09d86d115fe3894460e","unresolved":false,"context_lines":[{"line_number":440,"context_line":"            node \u003d compute_node[\u0027hypervisor_hostname\u0027]"},{"line_number":441,"context_line":"            state_key \u003d (host, node)"},{"line_number":442,"context_line":"            self.assertEqual(host_states_map[state_key].service,"},{"line_number":443,"context_line":"                obj_base.obj_to_primitive(fakes.get_service_by_host(host)))"},{"line_number":444,"context_line":""},{"line_number":445,"context_line":"        self.assertEqual(host_states_map[(\u0027host1\u0027, \u0027node1\u0027)].free_ram_mb,"},{"line_number":446,"context_line":"                         512)"}],"source_content_type":"text/x-python","patch_set":2,"id":"da6ed579_c5110406","line":443,"in_reply_to":"da6ed579_80a8e878","updated":"2016-01-18 16:28:53.000000000","message":"Done, thanks for the review!","commit_id":"8cb0a23f93b730611f754a8286536277a85c11da"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"36d6bdbb6bf2b0b5475367f3e8e038ad6afe8131","unresolved":false,"context_lines":[{"line_number":198,"context_line":"            info[\u0027got_fprops\u0027].append(filter_props)"},{"line_number":199,"context_line":"            return True"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"        self.stub_out(__name__ + \u0027.FakeFilterClass1._filter_one\u0027,"},{"line_number":202,"context_line":"                      fake_filter_one)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def _verify_result(self, info, result, filters\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_77a156f7","line":201,"updated":"2016-02-01 20:14:53.000000000","message":"again, using mock.patch.object(FakeFilterClass1, \u0027_filter_one\u0027) should be good, nope ?","commit_id":"a8ac201e319de218c0e5abf3886a1690f16f8f41"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"f568e0f0dd37da78958fb944bdac665ae507c346","unresolved":false,"context_lines":[{"line_number":198,"context_line":"            info[\u0027got_fprops\u0027].append(filter_props)"},{"line_number":199,"context_line":"            return True"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"        self.stub_out(__name__ + \u0027.FakeFilterClass1._filter_one\u0027,"},{"line_number":202,"context_line":"                      fake_filter_one)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def _verify_result(self, info, result, filters\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_0aaf6295","line":201,"in_reply_to":"7a5de9d1_2986f365","updated":"2016-02-02 16:47:47.000000000","message":"Yeah after discussing with sdague over IRC, he confirmed me that mock_out was just for one-line replacement of stubs.Set but was a temporary change.","commit_id":"a8ac201e319de218c0e5abf3886a1690f16f8f41"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"6f2aaf654e9b5c67ddee8555e45ea35843b010ba","unresolved":false,"context_lines":[{"line_number":198,"context_line":"            info[\u0027got_fprops\u0027].append(filter_props)"},{"line_number":199,"context_line":"            return True"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"        self.stub_out(__name__ + \u0027.FakeFilterClass1._filter_one\u0027,"},{"line_number":202,"context_line":"                      fake_filter_one)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def _verify_result(self, info, result, filters\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_8b113854","line":201,"in_reply_to":"7a5de9d1_77a156f7","updated":"2016-02-02 07:29:20.000000000","message":"As a rule, I\u0027ve been converting mox-\u003emock and stubs.Set -\u003e stub_out.\n\nBut perhaps that just means there\u0027s a gap in my knowledge of mock... Just calling stub_out seemed easier because I wasn\u0027t sure how/where to unpatch it after since this isn\u0027t a patch decorator on a test method or a patch context manager within a test method.\n\nDo you have a minute to show me what you mean, and how it gets unpatched after? I hope that\u0027s not a stupid question. Thanks!","commit_id":"a8ac201e319de218c0e5abf3886a1690f16f8f41"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"ee4640b40d365ff3fb8d4a82b3e6445228dfd46b","unresolved":false,"context_lines":[{"line_number":198,"context_line":"            info[\u0027got_fprops\u0027].append(filter_props)"},{"line_number":199,"context_line":"            return True"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"        self.stub_out(__name__ + \u0027.FakeFilterClass1._filter_one\u0027,"},{"line_number":202,"context_line":"                      fake_filter_one)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def _verify_result(self, info, result, filters\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_2986f365","line":201,"in_reply_to":"7a5de9d1_8b113854","updated":"2016-02-02 15:22:35.000000000","message":"I think that the difference is that for new code, using mock.patch.object() is preferred. stub_out() is a temporary fix designed solely for the removal of mox, as it closely follows the mox syntax, and accomplishes the same thing using mock.","commit_id":"a8ac201e319de218c0e5abf3886a1690f16f8f41"}]}
