)]}'
{"glance/hacking/checks.py":[{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"608226c40af46ab043b99fc7e52409fac132c39b","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    msg \u003d (\"G327: contextlib.nested is deprecated since Python 2.7. See \""},{"line_number":144,"context_line":"           \"https://docs.python.org/2/library/contextlib.html#contextlib.\""},{"line_number":145,"context_line":"           \"nested for more information.\")"},{"line_number":146,"context_line":"    if \"with contextlib.nested\" in logical_line:"},{"line_number":147,"context_line":"        yield(0, msg)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_0e7ccfea","line":146,"updated":"2015-03-18 11:06:45.000000000","message":"this check will not work if nested is imported like below:\n\nfrom contextlib import nested\n\nwith nested(......","commit_id":"be7669b71fe8b01900b11cf7ea44db9dcab6bb71"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"709417d74b4ca8aa972eee1e8ae8e79008f492db","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    msg \u003d (\"G327: contextlib.nested is deprecated since Python 2.7. See \""},{"line_number":144,"context_line":"           \"https://docs.python.org/2/library/contextlib.html#contextlib.\""},{"line_number":145,"context_line":"           \"nested for more information.\")"},{"line_number":146,"context_line":"    if \"with contextlib.nested\" in logical_line:"},{"line_number":147,"context_line":"        yield(0, msg)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_7440ba35","line":146,"in_reply_to":"9a80dd14_0e7ccfea","updated":"2015-03-18 11:39:45.000000000","message":"good catch! will update this and add test sample for this case.","commit_id":"be7669b71fe8b01900b11cf7ea44db9dcab6bb71"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"c2f85e16a0db1fc8562f5880f53d8d024080ac68","unresolved":false,"context_lines":[{"line_number":144,"context_line":"           \"https://docs.python.org/2/library/contextlib.html#contextlib.\""},{"line_number":145,"context_line":"           \"nested for more information.\")"},{"line_number":146,"context_line":"    if (\"with contextlib.nested(\" in logical_line"},{"line_number":147,"context_line":"        or \"with nested(\" in logical_line):"},{"line_number":148,"context_line":"        yield(0, msg)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_bfc3eb36","line":147,"updated":"2015-03-18 12:18:37.000000000","message":"This could create false positives if someone creates its own context manager called nested.\nThough it\u0027s no big deal since they would just be forced to change the name.","commit_id":"6d3c1d2d55ffed0e8f9f9eed3276fd32e9353a94"}],"glance/tests/unit/v1/test_api.py":[{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"55043904f9998a3108ffddea9308ced12fb7c842","unresolved":false,"context_lines":[{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        @mock.patch.object(ctlr, \u0027_external_source\u0027, return_value\u003dlocation)"},{"line_number":398,"context_line":"        @mock.patch.object(store, \u0027get_store_from_location\u0027,"},{"line_number":399,"context_line":"                           return_value\u003dscheme)"},{"line_number":400,"context_line":"        def do_test(mock_get_store_from_location, mock_external_source):"},{"line_number":401,"context_line":"            res \u003d req.get_response(self.api)"},{"line_number":402,"context_line":"            self.assertEqual(400, res.status_int)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_74cd155d","line":399,"updated":"2015-03-05 21:39:00.000000000","message":"I have to agree with Cindy on this, there\u0027s no real need for the do_test function.","commit_id":"74c10072036d3fafad7df5b30430af986811321c"},{"author":{"_account_id":9096,"name":"Cindy Pallares","email":"u1@cindy.sh","username":"cpallares"},"change_message_id":"e2f424983f650b6c2f62ab03290b48e0a55eb925","unresolved":false,"context_lines":[{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        @mock.patch.object(ctlr, \u0027_external_source\u0027, return_value\u003dlocation)"},{"line_number":398,"context_line":"        @mock.patch.object(store, \u0027get_store_from_location\u0027,"},{"line_number":399,"context_line":"                           return_value\u003dscheme)"},{"line_number":400,"context_line":"        def do_test(mock_get_store_from_location, mock_external_source):"},{"line_number":401,"context_line":"            res \u003d req.get_response(self.api)"},{"line_number":402,"context_line":"            self.assertEqual(400, res.status_int)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_6bcffd7f","line":399,"updated":"2015-03-05 19:00:37.000000000","message":"Perhaps, it would be better to move the mocks up to test_create_with_location(...) and remove the do_test function.","commit_id":"74c10072036d3fafad7df5b30430af986811321c"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"789ebc73c45418c33fd8f81dbd7c5263621215f3","unresolved":false,"context_lines":[{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        ctlr \u003d glance.api.v1.images.Controller"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        with mock.patch.object(ctlr, \u0027_external_source\u0027,"},{"line_number":398,"context_line":"                               return_value\u003dlocation) \\"},{"line_number":399,"context_line":"                as mock_external_source, \\"},{"line_number":400,"context_line":"                mock.patch.object(store, \u0027get_store_from_location\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_bae4bde1","line":397,"updated":"2015-03-06 10:08:15.000000000","message":"I forgot to mention you could also do in the test_create... method: @mock.patch.object(ctlr, \u0027_external_source\u0027, return_value\u003d\u0027bad+scheme\u0027)\nAnd so on, but it\u0027s less clear.","commit_id":"fc939891bae2435dc1aff1967deec6f1f4113526"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"b0f181f853d7e36ad24f2680006e53c51c99f3a0","unresolved":false,"context_lines":[{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        ctlr \u003d glance.api.v1.images.Controller"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        with mock.patch.object(ctlr, \u0027_external_source\u0027,"},{"line_number":398,"context_line":"                               return_value\u003dlocation) \\"},{"line_number":399,"context_line":"                as mock_external_source, \\"},{"line_number":400,"context_line":"                mock.patch.object(store, \u0027get_store_from_location\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_902c3f04","line":397,"updated":"2015-03-06 09:08:09.000000000","message":"I think this is less readable than with the do_test function since it splits into too many half \"sentences\".\nI didn\u0027t -1 original patch because it was a matter of a slight increase in clarity, but this one I think it\u0027s better not to merge, sorry.","commit_id":"fc939891bae2435dc1aff1967deec6f1f4113526"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"366a0805c899876cdaa1eaa9f005866dbfbb190b","unresolved":false,"context_lines":[{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        ctlr \u003d glance.api.v1.images.Controller"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        with mock.patch.object(ctlr, \u0027_external_source\u0027,"},{"line_number":398,"context_line":"                               return_value\u003dlocation) \\"},{"line_number":399,"context_line":"                as mock_external_source, \\"},{"line_number":400,"context_line":"                mock.patch.object(store, \u0027get_store_from_location\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_3a1fed09","line":397,"updated":"2015-03-06 10:04:13.000000000","message":"Well, you could do the same object patch you did to do_test in the test method and then assign the return values to the mocked objects. That\u0027s what we meant with our original comment.\nSo it would be like:\n```\n@mock.patch.object(ctlr, \u0027_external_source\u0027)\n@mock.patch.object(store, \u0027get_store_from_location\u0027)\ndef test_create_with_location_get_store_or_400_raises_exception(self, mock_get_store, mock_external_source):\n  location \u003d ...\n  scheme \u003d ...\n  mock_get_store.return_value \u003d scheme\n  mock_external_source.return_value \u003d location\n\n  res \u003d req.get_response(self.api)\n```","commit_id":"fc939891bae2435dc1aff1967deec6f1f4113526"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"73c8a80e679f7729dd6f6bfcfc19e852de5c73af","unresolved":false,"context_lines":[{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        ctlr \u003d glance.api.v1.images.Controller"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        with mock.patch.object(ctlr, \u0027_external_source\u0027,"},{"line_number":398,"context_line":"                               return_value\u003dlocation) \\"},{"line_number":399,"context_line":"                as mock_external_source, \\"},{"line_number":400,"context_line":"                mock.patch.object(store, \u0027get_store_from_location\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_d79dcc0b","line":397,"in_reply_to":"9a80dd14_902c3f04","updated":"2015-03-06 09:53:17.000000000","message":"We can\u0027t move up the @mock.patch.object statement to test method,  because it\u0027s using internal variable  like \u0027location\u0027.   So there are only two ways as I know so far:\n\n1)  Use  internal method  do_test()\n\n2)  Use with multiple statement , we  must use  \u0027\\\u0027,\n\nIs there any other way ?","commit_id":"fc939891bae2435dc1aff1967deec6f1f4113526"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"e36c9d8014931d33e458708cc1853de0aa07bc8c","unresolved":false,"context_lines":[{"line_number":394,"context_line":""},{"line_number":395,"context_line":"        ctlr \u003d glance.api.v1.images.Controller"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":"        with mock.patch.object(ctlr, \u0027_external_source\u0027,"},{"line_number":398,"context_line":"                               return_value\u003dlocation) \\"},{"line_number":399,"context_line":"                as mock_external_source, \\"},{"line_number":400,"context_line":"                mock.patch.object(store, \u0027get_store_from_location\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_6056182c","line":397,"in_reply_to":"9a80dd14_bae4bde1","updated":"2015-03-06 11:41:55.000000000","message":"yeah, thanks , we can  set the return_value  in  test_create... method after apply decorator","commit_id":"fc939891bae2435dc1aff1967deec6f1f4113526"}]}
