)]}'
{"ironic_python_agent/tests/unit/hardware_managers/test_mlnx.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"b0484209ca27cac5fdedef3a1085f07b78c6bcbb","unresolved":false,"context_lines":[{"line_number":136,"context_line":"        mock_get_mac.return_value \u003d IB_ADDRESS"},{"line_number":137,"context_line":"        self.assertRaises("},{"line_number":138,"context_line":"            errors.IncompatibleHardwareMethodError,"},{"line_number":139,"context_line":"            self.hardware.get_interface_info, \u0027ib0\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df7087c5_da51a610","line":139,"updated":"2018-03-07 23:20:34.000000000","message":"I don\u0027t have time to look into the code, but I don\u0027t see why you still need mocked_open. Also, there are two places where errors.IncompatibleHardwareMethodError is raised -- it isn\u0027t clear what you are testing/which code patch you think it should be raised from?","commit_id":"8bc2eccaeb8c31af6521842b0b3289ad3ff81f03"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"859342839195b910928dde554612607f80694339","unresolved":false,"context_lines":[{"line_number":136,"context_line":"        mock_get_mac.return_value \u003d IB_ADDRESS"},{"line_number":137,"context_line":"        self.assertRaises("},{"line_number":138,"context_line":"            errors.IncompatibleHardwareMethodError,"},{"line_number":139,"context_line":"            self.hardware.get_interface_info, \u0027ib0\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df7087c5_fe89f925","line":139,"in_reply_to":"df7087c5_da51a610","updated":"2018-03-08 06:40:45.000000000","message":"regarding mocking the open at first we had 2 call of open\n1. for getting the mac address\n2. for getting the vendor-id.\nafter the change we left with mocking the getting of the vendor id.\n\nregarding you InconpariableHardwareError I am raseing in 2 cases \n1. when we can\u0027t get the mac address (I need to add unitest for that)\n2. when the vendor is not mellanox","commit_id":"8bc2eccaeb8c31af6521842b0b3289ad3ff81f03"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"04464d19bb7697eb389c212a136aaee8a3f409a1","unresolved":false,"context_lines":[{"line_number":136,"context_line":"        mock_get_mac.return_value \u003d IB_ADDRESS"},{"line_number":137,"context_line":"        self.assertRaises("},{"line_number":138,"context_line":"            errors.IncompatibleHardwareMethodError,"},{"line_number":139,"context_line":"            self.hardware.get_interface_info, \u0027ib0\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df7087c5_03b6c8fb","line":139,"in_reply_to":"df7087c5_fe89f925","updated":"2018-03-08 15:54:58.000000000","message":"I can see why you needed mocked_open for testing the original code. With your change, though, it seems to me that it\u0027d be cleaner to mock hardware._get_device_info() -- which could just return the value that your read_mock.side_effect is returning?\n\nwrt which code path is taken that causes the errors.IncompatibleHardwareMethodError to be raised. I think it would be helpful to check if the mocks were called. Well, really, mock_get_mac should always be called; the question is whether the exception was raised there (your #1), or after mock_open was called (your #2)\n\nAnyway, it is good practise to check if the mocks were called. useful if eg the code is changed in the future in a way that is incorrect/unexpected.","commit_id":"8bc2eccaeb8c31af6521842b0b3289ad3ff81f03"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"04464d19bb7697eb389c212a136aaee8a3f409a1","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            errors.IncompatibleHardwareMethodError,"},{"line_number":139,"context_line":"            self.hardware.get_interface_info, \u0027ib0\u0027)"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    @mock.patch.object(netutils, \u0027get_mac_addr\u0027, autospec\u003dTrue)"},{"line_number":142,"context_line":"    def test_get_interface_info_no_mac_address(self, mock_get_mac):"},{"line_number":143,"context_line":"        mock_get_mac.return_value \u003d None"},{"line_number":144,"context_line":"        self.assertRaises("}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_23b0acf4","line":141,"updated":"2018-03-08 15:54:58.000000000","message":"if you add a mock for hardware._get_device_info(), you can check below to confirm that it was never called.","commit_id":"03b808802f2a739d0c71a074b8d31f2816d57905"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"a13b766600ff57dcf7c13d3a3254ffc8836712e5","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            errors.IncompatibleHardwareMethodError,"},{"line_number":139,"context_line":"            self.hardware.get_interface_info, \u0027ib0\u0027)"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    @mock.patch.object(netutils, \u0027get_mac_addr\u0027, autospec\u003dTrue)"},{"line_number":142,"context_line":"    def test_get_interface_info_no_mac_address(self, mock_get_mac):"},{"line_number":143,"context_line":"        mock_get_mac.return_value \u003d None"},{"line_number":144,"context_line":"        self.assertRaises("}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_9dd52846","line":141,"in_reply_to":"df7087c5_23b0acf4","updated":"2018-03-11 09:53:22.000000000","message":"Done","commit_id":"03b808802f2a739d0c71a074b8d31f2816d57905"}]}
