)]}'
{"neutron/tests/unit/midonet/test_midonet_plugin.py":[{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"14eafdeb4edb229d74e26df7aa0e775c704c1b42","unresolved":false,"context_lines":[{"line_number":60,"context_line":"    def tearDown(self):"},{"line_number":61,"context_line":"        super(MidonetPluginV2TestCase, self).tearDown()"},{"line_number":62,"context_line":"        self.mock_api.stop()"},{"line_number":63,"context_line":"        # prevent module mock from saving calls between tests"},{"line_number":64,"context_line":"        sys.modules[\"midonetclient\"].reset_mock()"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_3fcb6d1f","line":63,"updated":"2014-06-02 12:12:04.000000000","message":"Should be done as part of setUp() with addCleanup(), because if there is a failure in setup, the tearDown will not be invoked.\n\nAlso, can you elaborate on why the mock is done at top level vs setUp(), for my education?","commit_id":"dd818c0eba76660d35efea122ae8b15e0f53bcf0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"b9da636360aa1d55f96e9e9c9b67a8519d5a1859","unresolved":false,"context_lines":[{"line_number":60,"context_line":"    def tearDown(self):"},{"line_number":61,"context_line":"        super(MidonetPluginV2TestCase, self).tearDown()"},{"line_number":62,"context_line":"        self.mock_api.stop()"},{"line_number":63,"context_line":"        # prevent module mock from saving calls between tests"},{"line_number":64,"context_line":"        sys.modules[\"midonetclient\"].reset_mock()"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_cc301704","line":63,"in_reply_to":"1ae5cdf2_3fcb6d1f","updated":"2014-06-02 20:23:17.000000000","message":"I\u0027m glad you asked this. I dug into it a little more and the mock being at the module level looks like it was required for two reasons. First, test_midonet_lib was implicitly depending on this file modifying the system modules. If it wasn\u0027t mocked until setUp here, test_midonet_lib would have failed to import correctly. Second, the mixin order on the NatTestCase down below was backwards so a mock in this setup would take effect after\nthe plugin was already initialized by the L3NatDBIntTestCase setUp routine. \n\nNow that I know this, I can remove all of the global ones and remove the need for the resets.","commit_id":"dd818c0eba76660d35efea122ae8b15e0f53bcf0"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"43cf7e012ae3fa251f6f7f25ca29e6513d23bc76","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        test_lib.test_config[\u0027config_files\u0027] \u003d [os.path.join("},{"line_number":49,"context_line":"            etc_path, \u0027midonet.ini.test\u0027)]"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        mock.patch.dict(sys.modules, {\u0027midonetclient\u0027: mock.Mock()}).start()"},{"line_number":52,"context_line":"        self.instance \u003d self.mock_api.start()"},{"line_number":53,"context_line":"        mock_cfg \u003d mock_lib.MidonetLibMockConfig(self.instance.return_value)"},{"line_number":54,"context_line":"        mock_cfg.setup()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1ae5cdf2_4373e87f","line":51,"updated":"2014-06-03 08:14:26.000000000","message":"can you please check whether mock.patch.stopall() handles patched dicts? if no, I believe cleanup should be added","commit_id":"e9e9c66d742881fb6fb694e80f5ab2fc549c2165"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"d8bdd9a8552a6ae8a1c72a6b3a8747a9f5d09c44","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        test_lib.test_config[\u0027config_files\u0027] \u003d [os.path.join("},{"line_number":49,"context_line":"            etc_path, \u0027midonet.ini.test\u0027)]"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        mock.patch.dict(sys.modules, {\u0027midonetclient\u0027: mock.Mock()}).start()"},{"line_number":52,"context_line":"        self.instance \u003d self.mock_api.start()"},{"line_number":53,"context_line":"        mock_cfg \u003d mock_lib.MidonetLibMockConfig(self.instance.return_value)"},{"line_number":54,"context_line":"        mock_cfg.setup()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1ae5cdf2_48694024","line":51,"in_reply_to":"1ae5cdf2_1ed693c5","updated":"2014-06-03 09:19:38.000000000","message":"Really good catch. it might be a bug of mock library.","commit_id":"e9e9c66d742881fb6fb694e80f5ab2fc549c2165"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"a22866e9364c83acadb07edbe86622be9d54cef8","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        test_lib.test_config[\u0027config_files\u0027] \u003d [os.path.join("},{"line_number":49,"context_line":"            etc_path, \u0027midonet.ini.test\u0027)]"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"        mock.patch.dict(sys.modules, {\u0027midonetclient\u0027: mock.Mock()}).start()"},{"line_number":52,"context_line":"        self.instance \u003d self.mock_api.start()"},{"line_number":53,"context_line":"        mock_cfg \u003d mock_lib.MidonetLibMockConfig(self.instance.return_value)"},{"line_number":54,"context_line":"        mock_cfg.setup()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1ae5cdf2_1ed693c5","line":51,"in_reply_to":"1ae5cdf2_4373e87f","updated":"2014-06-03 08:44:24.000000000","message":"good catch. stopall does not seem to affect dict patches.","commit_id":"e9e9c66d742881fb6fb694e80f5ab2fc549c2165"}]}
