)]}'
{"ironic/tests/drivers/test_deploy_utils.py":[{"author":{"_account_id":14760,"name":"John L. Villalovos","email":"openstack.org@sodarock.com","username":"jlvillal"},"change_message_id":"4b0ad78d7da4e3706e8c888a7ebf9d8636507eae","unresolved":false,"context_lines":[{"line_number":1483,"context_line":""},{"line_number":1484,"context_line":"    def setUp(self):"},{"line_number":1485,"context_line":"        super(GetConfigdriveTestCase, self).setUp()"},{"line_number":1486,"context_line":"        fake_file \u003d mock.Mock(spec\u003dfile)"},{"line_number":1487,"context_line":"        fake_file.tell.return_value \u003d 10"},{"line_number":1488,"context_line":"        fake_file.name \u003d \u0027/tmp/foo\u0027"},{"line_number":1489,"context_line":"        ntf \u003d mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_5d1cf312","line":1486,"updated":"2015-07-07 13:33:58.000000000","message":"Should this (and other variables in this function) be stored as:\n\n self.fake_file  ?\n\nSeems like when the function goes out of scope, things could disappear.","commit_id":"353fea2d93a531f5233bc917f12a2e9d89d41427"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"9b47e1e3679f69c19a8ac4f2b220bb59c826f6b8","unresolved":false,"context_lines":[{"line_number":1486,"context_line":"        fake_file \u003d mock.Mock(spec\u003dfile)"},{"line_number":1487,"context_line":"        fake_file.tell.return_value \u003d 10"},{"line_number":1488,"context_line":"        fake_file.name \u003d \u0027/tmp/foo\u0027"},{"line_number":1489,"context_line":"        ntf \u003d mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027)"},{"line_number":1490,"context_line":"        ntf.start().return_value \u003d fake_file"},{"line_number":1491,"context_line":"        self.addCleanup(ntf.stop)"},{"line_number":1492,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_34cb4c55","line":1489,"updated":"2015-07-07 12:49:54.000000000","message":"please move this on upper level as decorator","commit_id":"353fea2d93a531f5233bc917f12a2e9d89d41427"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"3772d3b59f5f786553e5f92446e1e3e89344313b","unresolved":false,"context_lines":[{"line_number":1486,"context_line":"        fake_file \u003d mock.Mock(spec\u003dfile)"},{"line_number":1487,"context_line":"        fake_file.tell.return_value \u003d 10"},{"line_number":1488,"context_line":"        fake_file.name \u003d \u0027/tmp/foo\u0027"},{"line_number":1489,"context_line":"        ntf \u003d mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027)"},{"line_number":1490,"context_line":"        ntf.start().return_value \u003d fake_file"},{"line_number":1491,"context_line":"        self.addCleanup(ntf.stop)"},{"line_number":1492,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_c831230d","line":1489,"in_reply_to":"ba3cc151_28a9af7b","updated":"2015-07-07 13:56:28.000000000","message":"oh, that\u0027s funny. Then I\u0027d vote either for precreated object or for an argument to every test. But what you have here is what we spend a lot of time to avoid :)","commit_id":"353fea2d93a531f5233bc917f12a2e9d89d41427"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"bbd1a7b62b4cce54005379de1341ddecab429b0d","unresolved":false,"context_lines":[{"line_number":1486,"context_line":"        fake_file \u003d mock.Mock(spec\u003dfile)"},{"line_number":1487,"context_line":"        fake_file.tell.return_value \u003d 10"},{"line_number":1488,"context_line":"        fake_file.name \u003d \u0027/tmp/foo\u0027"},{"line_number":1489,"context_line":"        ntf \u003d mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027)"},{"line_number":1490,"context_line":"        ntf.start().return_value \u003d fake_file"},{"line_number":1491,"context_line":"        self.addCleanup(ntf.stop)"},{"line_number":1492,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_fab94d2f","line":1489,"in_reply_to":"ba3cc151_34cb4c55","updated":"2015-07-07 13:15:31.000000000","message":"I didn\u0027t do that because otherwise I would have to add a new parameter for every method of this class.\n\nI could create the fake_file mock outside the class and pass it as return_value to the decorator, do you think it would be better?","commit_id":"353fea2d93a531f5233bc917f12a2e9d89d41427"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"fd5649ab59dfa8497d226f6c5bcf23aac83a656b","unresolved":false,"context_lines":[{"line_number":1486,"context_line":"        fake_file \u003d mock.Mock(spec\u003dfile)"},{"line_number":1487,"context_line":"        fake_file.tell.return_value \u003d 10"},{"line_number":1488,"context_line":"        fake_file.name \u003d \u0027/tmp/foo\u0027"},{"line_number":1489,"context_line":"        ntf \u003d mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027)"},{"line_number":1490,"context_line":"        ntf.start().return_value \u003d fake_file"},{"line_number":1491,"context_line":"        self.addCleanup(ntf.stop)"},{"line_number":1492,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_28a9af7b","line":1489,"in_reply_to":"ba3cc151_fa586d58","updated":"2015-07-07 13:49:34.000000000","message":"Yeah I\u0027ve tried but it doesn\u0027t work, the problem is \"name\" is a paramter for Mock()[1]\n\nSo you can\u0027t do it when instantiating the object, e.g:\n\n In [19]: a \u003d mock.Mock(spec\u003dfile, name\u003d\u0027/tmp/foo\u0027, tell\u003dlambda *_: 10)\n\n In [20]: a.name\n Out[20]: \u003cMock name\u003d\u0027/tmp/foo.name\u0027 id\u003d\u002717579664\u0027\u003e\n\n In [21]: a.tell()\n Out[21]: 10\n\n\n[1] https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock","commit_id":"353fea2d93a531f5233bc917f12a2e9d89d41427"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0c46efcb45a8f7ffcd8330943759a3fd87143ff1","unresolved":false,"context_lines":[{"line_number":1486,"context_line":"        fake_file \u003d mock.Mock(spec\u003dfile)"},{"line_number":1487,"context_line":"        fake_file.tell.return_value \u003d 10"},{"line_number":1488,"context_line":"        fake_file.name \u003d \u0027/tmp/foo\u0027"},{"line_number":1489,"context_line":"        ntf \u003d mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027)"},{"line_number":1490,"context_line":"        ntf.start().return_value \u003d fake_file"},{"line_number":1491,"context_line":"        self.addCleanup(ntf.stop)"},{"line_number":1492,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba3cc151_fa586d58","line":1489,"in_reply_to":"ba3cc151_fab94d2f","updated":"2015-07-07 13:25:16.000000000","message":"yeah, something like\n\n @mock.patch.object(tempfile, \u0027NamedTemporaryFile\u0027, mock.Mock(spec\u003dfile, name\u003d\u0027/tmp/foo\u0027, **{\u0027tell.return_value\u0027: 10})\n\nshould work and won\u0027t require a new parameter","commit_id":"353fea2d93a531f5233bc917f12a2e9d89d41427"}]}
