)]}'
{"keystone/identity/core.py":[{"author":{"_account_id":6771,"name":"tiago-martins","email":"tiago.ferraz@gmail.com","username":"tiago-martins"},"change_message_id":"88a4eb9ba3cacc31c222fceb0669f7fada4c540f","unresolved":false,"context_lines":[{"line_number":138,"context_line":"                if (fname.startswith(DOMAIN_CONF_FHEAD) and"},{"line_number":139,"context_line":"                        fname.endswith(DOMAIN_CONF_FTAIL)):"},{"line_number":140,"context_line":"                    names \u003d fname.split(\u0027.\u0027)"},{"line_number":141,"context_line":"                    if len(names) \u003e\u003d 3:"},{"line_number":142,"context_line":"                        self._load_config(assignment_api,"},{"line_number":143,"context_line":"                                          [os.path.join(r, fname)],"},{"line_number":144,"context_line":"                                          fname[len(DOMAIN_CONF_FHEAD):"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FeOI%3D","line":141,"updated":"2014-03-17 17:45:30.000000000","message":"Isn\u0027t faster if we do fname.count(\u0027.\u0027) instead of a split and a count? If fnames have more than 2 \".\"; then len(name) will be more than 3.","commit_id":"231ded3ac6918afa51f629d772b00ec170edef92"}],"keystone/tests/unit/identity/test_core.py":[{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"69cdd143d3069626e1c1182e97999d3db95f8db0","unresolved":false,"context_lines":[{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def _mock_load_config(self, assignment_api, file_list, domain_name):"},{"line_number":64,"context_line":"        if domain_name !\u003d \u0027abc.def.com\u0027:"},{"line_number":65,"context_line":"            raise"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    @mock.patch.object(identity.DomainConfigs,"},{"line_number":68,"context_line":"                       \u0027_load_config\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2B10w%3D","line":65,"updated":"2014-03-23 14:47:19.000000000","message":"this obviously isn\u0027t getting called.","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"045134ffe4aff8aeb41f7f3d642be23dc1772136","unresolved":false,"context_lines":[{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def _mock_load_config(self, assignment_api, file_list, domain_name):"},{"line_number":64,"context_line":"        if domain_name !\u003d \u0027abc.def.com\u0027:"},{"line_number":65,"context_line":"            raise"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    @mock.patch.object(identity.DomainConfigs,"},{"line_number":68,"context_line":"                       \u0027_load_config\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2BRic%3D","line":65,"in_reply_to":"AAAAWH%2F%2B0oA%3D","updated":"2014-03-27 22:31:14.000000000","message":"You can verify parameters from the magic mock object itself. Don\u0027t use a raise method like this, use the assertEqual (etc) that is part of the test cases.\n\nYou can see an example of arg introspection in this patchset https://review.openstack.org/#/c/83235/ where the use of the mox module is removed (look at the new tests).","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"c963fa87cd826faec09088a2a13cdde7eb373a2a","unresolved":false,"context_lines":[{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def _mock_load_config(self, assignment_api, file_list, domain_name):"},{"line_number":64,"context_line":"        if domain_name !\u003d \u0027abc.def.com\u0027:"},{"line_number":65,"context_line":"            raise"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    @mock.patch.object(identity.DomainConfigs,"},{"line_number":68,"context_line":"                       \u0027_load_config\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2BeYM%3D","line":65,"in_reply_to":"AAAAWH%2F%2B0oA%3D","updated":"2014-03-26 15:06:12.000000000","message":"raise anything explicitly rather than implicitly raising None","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":9101,"name":"wanghong","email":"reviewwanghong@126.com","username":"wanghong"},"change_message_id":"92fcb65bd8f50bc1586a3d3a5e3b90f3fcafac1a","unresolved":false,"context_lines":[{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def _mock_load_config(self, assignment_api, file_list, domain_name):"},{"line_number":64,"context_line":"        if domain_name !\u003d \u0027abc.def.com\u0027:"},{"line_number":65,"context_line":"            raise"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    @mock.patch.object(identity.DomainConfigs,"},{"line_number":68,"context_line":"                       \u0027_load_config\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2B0oA%3D","line":65,"in_reply_to":"AAAAWH%2F%2B10w%3D","updated":"2014-03-24 01:45:56.000000000","message":"This method is mocked as identity.DomainConfigs._load_config using @mock.patch.object. So, I can verify the parameters that setup_domain_drivers  passed.","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"69cdd143d3069626e1c1182e97999d3db95f8db0","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        # from filename."},{"line_number":73,"context_line":"        domain_config_filename \u003d os.path.join(self.tmp_dir,"},{"line_number":74,"context_line":"                                              \u0027keystone.abc.def.com.conf\u0027)"},{"line_number":75,"context_line":"        self.addCleanup(lambda: os.remove(domain_config_filename))"},{"line_number":76,"context_line":"        with open(domain_config_filename, \u0027w\u0027):"},{"line_number":77,"context_line":"            \"\"\"Write an empty config file.\"\"\""},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2B11E%3D","line":75,"updated":"2014-03-23 14:47:19.000000000","message":"the file hasn\u0027t been written yet so the cleanup should be after line 77.","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":1916,"name":"Guang Yee","email":"gyee@suse.com","username":"guang-yee"},"change_message_id":"15a68658b469eb8ca4ac77565feda96d7916ee51","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        # from filename."},{"line_number":73,"context_line":"        domain_config_filename \u003d os.path.join(self.tmp_dir,"},{"line_number":74,"context_line":"                                              \u0027keystone.abc.def.com.conf\u0027)"},{"line_number":75,"context_line":"        self.addCleanup(lambda: os.remove(domain_config_filename))"},{"line_number":76,"context_line":"        with open(domain_config_filename, \u0027w\u0027):"},{"line_number":77,"context_line":"            \"\"\"Write an empty config file.\"\"\""},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2BjCU%3D","line":75,"in_reply_to":"AAAAWH%2F%2B0m0%3D","updated":"2014-03-26 01:20:49.000000000","message":"yes, that\u0027s correct according to the doc\n\nhttp://docs.python.org/2/library/unittest.html\n\n\"Add a function to be called after tearDown() to cleanup resources used during the test. Functions will be called in reverse order to the order they are added (LIFO). They are called with any arguments and keyword arguments passed into addCleanup() when they are added.\n\nIf setUp() fails, meaning that tearDown() is not called, then any cleanup functions added will still be called.\"","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":9101,"name":"wanghong","email":"reviewwanghong@126.com","username":"wanghong"},"change_message_id":"92fcb65bd8f50bc1586a3d3a5e3b90f3fcafac1a","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        # from filename."},{"line_number":73,"context_line":"        domain_config_filename \u003d os.path.join(self.tmp_dir,"},{"line_number":74,"context_line":"                                              \u0027keystone.abc.def.com.conf\u0027)"},{"line_number":75,"context_line":"        self.addCleanup(lambda: os.remove(domain_config_filename))"},{"line_number":76,"context_line":"        with open(domain_config_filename, \u0027w\u0027):"},{"line_number":77,"context_line":"            \"\"\"Write an empty config file.\"\"\""},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2B0m0%3D","line":75,"in_reply_to":"AAAAWH%2F%2B11E%3D","updated":"2014-03-24 01:45:56.000000000","message":"I think the self.addCleanup method just registers the cleapup method. Actually, the cleanup method will be called when tearDown.","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"045134ffe4aff8aeb41f7f3d642be23dc1772136","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        # from filename."},{"line_number":73,"context_line":"        domain_config_filename \u003d os.path.join(self.tmp_dir,"},{"line_number":74,"context_line":"                                              \u0027keystone.abc.def.com.conf\u0027)"},{"line_number":75,"context_line":"        self.addCleanup(lambda: os.remove(domain_config_filename))"},{"line_number":76,"context_line":"        with open(domain_config_filename, \u0027w\u0027):"},{"line_number":77,"context_line":"            \"\"\"Write an empty config file.\"\"\""},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2BRiA%3D","line":75,"in_reply_to":"AAAAWH%2F%2BaXs%3D","updated":"2014-03-27 22:31:14.000000000","message":"Don\u0027t pass this as a lambda, addCleanup calls the first argument with the values from the subsequent argument, so this should be:\n\n    self.addCleanup(os.remove, domain_config_filename)","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"9daa7391a89f854415d44c7ed0302fc3820877e2","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        # from filename."},{"line_number":73,"context_line":"        domain_config_filename \u003d os.path.join(self.tmp_dir,"},{"line_number":74,"context_line":"                                              \u0027keystone.abc.def.com.conf\u0027)"},{"line_number":75,"context_line":"        self.addCleanup(lambda: os.remove(domain_config_filename))"},{"line_number":76,"context_line":"        with open(domain_config_filename, \u0027w\u0027):"},{"line_number":77,"context_line":"            \"\"\"Write an empty config file.\"\"\""},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2BaXs%3D","line":75,"in_reply_to":"AAAAWH%2F%2BjCU%3D","updated":"2014-03-27 00:12:54.000000000","message":"The functions registered in addCleanup are called even if the method raises. In this case, if the open() at line 76 raises (because it can\u0027t open the file for some reason), then the cleanup function will run and attempt to delete the file, which will also fail, so you\u0027ll get another failure that will be confusing.","commit_id":"d06e32275a0fffe2b4852caea68d8b20dc8a23bb"}]}
