)]}'
{"cinder/tests/unit/test_vmware_vmdk.py":[{"author":{"_account_id":4523,"name":"Eric Harney","email":"eharney@redhat.com","username":"eharney"},"change_message_id":"679e8df6d64f03dc783279a87b333cc5174e59e0","unresolved":false,"context_lines":[{"line_number":1428,"context_line":"                          fake_name, fake_size)"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"    @mock.patch.object(image_transfer, \u0027copy_stream_optimized_disk\u0027)"},{"line_number":1431,"context_line":"    @mock.patch(\u0027cinder.volume.drivers.vmware.vmdk.open\u0027, create\u003dTrue)"},{"line_number":1432,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_temporary_file\u0027)"},{"line_number":1433,"context_line":"    @mock.patch(\u0027oslo_utils.uuidutils.generate_uuid\u0027)"},{"line_number":1434,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_create_backing\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_31523f36","line":1431,"updated":"2015-09-04 16:16:42.000000000","message":"This might work (I\u0027m not sure), but it really doesn\u0027t look like the right way to do this.\n\n\u0027cinder.volume.drivers.vmware.vmdk.open\u0027 doesn\u0027t exist... surely there is a cleaner way to accomplish this?","commit_id":"05c2ba2ebc6041c2e3d3481c1898a90517d01e5b"},{"author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"change_message_id":"ab07b7185492cc7c82053578978d65aadb808009","unresolved":false,"context_lines":[{"line_number":1428,"context_line":"                          fake_name, fake_size)"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"    @mock.patch.object(image_transfer, \u0027copy_stream_optimized_disk\u0027)"},{"line_number":1431,"context_line":"    @mock.patch(\u0027cinder.volume.drivers.vmware.vmdk.open\u0027, create\u003dTrue)"},{"line_number":1432,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_temporary_file\u0027)"},{"line_number":1433,"context_line":"    @mock.patch(\u0027oslo_utils.uuidutils.generate_uuid\u0027)"},{"line_number":1434,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_create_backing\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_a7a60d0d","line":1431,"in_reply_to":"da20952f_31523f36","updated":"2015-09-04 16:38:22.000000000","message":"I believe this will mock any instance of open with the cinder/volume/drivers/vmware/vmdk.py file. I believe that is what we would want, rather than globally mocking or creating some kind of wrapper class to be mocked out.","commit_id":"05c2ba2ebc6041c2e3d3481c1898a90517d01e5b"},{"author":{"_account_id":9171,"name":"Vipin Balachandran","email":"vipin.bl@gmail.com","username":"vbala"},"change_message_id":"349bd1964667b8547f464c0cc0eb7ef22a6e060c","unresolved":false,"context_lines":[{"line_number":1428,"context_line":"                          fake_name, fake_size)"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"    @mock.patch.object(image_transfer, \u0027copy_stream_optimized_disk\u0027)"},{"line_number":1431,"context_line":"    @mock.patch(\u0027cinder.volume.drivers.vmware.vmdk.open\u0027, create\u003dTrue)"},{"line_number":1432,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_temporary_file\u0027)"},{"line_number":1433,"context_line":"    @mock.patch(\u0027oslo_utils.uuidutils.generate_uuid\u0027)"},{"line_number":1434,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_create_backing\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_36a675c1","line":1431,"in_reply_to":"da20952f_9d055a11","updated":"2015-09-07 14:02:02.000000000","message":"\u003eAre we doing this b/c vmdk does not really contain an \u0027open\u0027 that we can mock out, but doing so effectively masks out the global open() within the scope of the vmdk module\n\nThat\u0027s correct.\n\n\u003eWhy can\u0027t this be done with mock_open() as described at:\n\n\u003e http://www.voidspace.org.uk/python/mock/helpers.html#mock-open\n\nmock_open() is a helper which gives a mock to replace \u0027open\u0027. For example, we can set the return value of \u0027read\u0027 by passing the value to read_data param while calling mock_open. Also see the example given in that link. It is patching \u0027__main__.open\u0027 (not builtins open) because the namespace of the code which calls \u0027open\u0027 is \u0027__main__\u0027. Therefore the approach is same-- bind open to the namespace of the code under testing.\n\n\u003ehttp://boris-42.me/the-simplest-way-in-python-to-mock-open-during-unittest/\n\nIt\u0027s not working:\n\"TypeError: Need a valid target to patch. You supplied: \u0027open\u0027\"\n\nAnother option is to use a wrapper for \u0027open\u0027 like \u0027cinder.openstack.common.fileutils.file_open\u0027. But it is removed now, do we need to re-introduce it and update several \u0027open\u0027 calls?\n\nAlso see:\nhttp://www.voidspace.org.uk/python/weblog/arch_d7_2010_10_02.shtml","commit_id":"05c2ba2ebc6041c2e3d3481c1898a90517d01e5b"},{"author":{"_account_id":9003,"name":"Tom Barron","email":"tpb@dyncloud.net","username":"tbarron"},"change_message_id":"bf7068540e0ddc7e0f05d5380b747aa05c837d6e","unresolved":false,"context_lines":[{"line_number":1428,"context_line":"                          fake_name, fake_size)"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"    @mock.patch.object(image_transfer, \u0027copy_stream_optimized_disk\u0027)"},{"line_number":1431,"context_line":"    @mock.patch(\u0027cinder.volume.drivers.vmware.vmdk.open\u0027, create\u003dTrue)"},{"line_number":1432,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_temporary_file\u0027)"},{"line_number":1433,"context_line":"    @mock.patch(\u0027oslo_utils.uuidutils.generate_uuid\u0027)"},{"line_number":1434,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_create_backing\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_9d055a11","line":1431,"in_reply_to":"da20952f_a7a60d0d","updated":"2015-09-04 17:23:28.000000000","message":"Just logging here the convo we had on IRC?\n\nWhat is the point of the \u0027create\u003dTrue\u0027, which is generally considered dangerous as it creates a mock method automagically, as I understand it.  Are we doing this b/c vmdk does not really contain an \u0027open\u0027 that we can mock out, but doing so effectively masks out the global open() within the scope of the vmdk module?  I\u0027m just guessing ...\n\nWhy can\u0027t this be done with mock_open() as described at:\n\nhttp://www.voidspace.org.uk/python/mock/helpers.html#mock-open\n\nand \n\n http://boris-42.me/the-simplest-way-in-python-to-mock-open-during-unittest/","commit_id":"05c2ba2ebc6041c2e3d3481c1898a90517d01e5b"},{"author":{"_account_id":4523,"name":"Eric Harney","email":"eharney@redhat.com","username":"eharney"},"change_message_id":"96870fa8ff8982f269f16b30ad5cd6778d37f9cd","unresolved":false,"context_lines":[{"line_number":1428,"context_line":"                          fake_name, fake_size)"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"    @mock.patch.object(image_transfer, \u0027copy_stream_optimized_disk\u0027)"},{"line_number":1431,"context_line":"    @mock.patch(\u0027cinder.volume.drivers.vmware.vmdk.open\u0027, create\u003dTrue)"},{"line_number":1432,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_temporary_file\u0027)"},{"line_number":1433,"context_line":"    @mock.patch(\u0027oslo_utils.uuidutils.generate_uuid\u0027)"},{"line_number":1434,"context_line":"    @mock.patch.object(VMDK_DRIVER, \u0027_create_backing\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_a2083b81","line":1431,"in_reply_to":"da20952f_a7a60d0d","updated":"2015-09-04 17:14:42.000000000","message":"This still feels a little strange to me, but, I\u0027ll let you guys decide for now since I don\u0027t have great alternatives at this point.","commit_id":"05c2ba2ebc6041c2e3d3481c1898a90517d01e5b"}]}
