)]}'
{"os_brick/tests/initiator/connectors/test_iscsi.py":[{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"cfe1a9e8b847f1a00d4f056e00706521262f6c53","unresolved":false,"context_lines":[{"line_number":1238,"context_line":"                    \u0027path\u0027: \u0027/dev/dm-0\u0027}"},{"line_number":1239,"context_line":"        self.assertEqual(expected, res)"},{"line_number":1240,"context_line":""},{"line_number":1241,"context_line":"        self.assertEqual(2, get_wwn_mock.call_count)"},{"line_number":1242,"context_line":"        result \u003d list(get_wwn_mock.call_args[0][0])"},{"line_number":1243,"context_line":"        result.sort()"},{"line_number":1244,"context_line":"        self.assertEqual([\u0027sda\u0027, \u0027sdb\u0027, \u0027sdc\u0027, \u0027sdd\u0027], result)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_e291a548","line":1241,"updated":"2020-09-01 15:05:25.000000000","message":"The reason why this fails in Python 2.7 and not 3.x seems to have to do with the different behavior of the call to `thread.start()`.\n\nIn Python 3.7 it\u0027s immediately starting the code in this file\u0027s line 1225-1231, but in 2.7 it doesn\u0027t start until eventlet decides to, which is not immediately since the sleep is mocked.\n\nSolution is to either change this call to:\n\n  self.assertGreaterEqual(get_wwn_mock.call_count, 2)\n\nIn this case we don\u0027t know how long it\u0027ll take for it to finish, though in 100 test runs the average test run was 0.0054 seconds.\n\nThe other solution is to `import time` and create a global variable to store the sleep method `ORIGINAL_SLEEP \u003d time.sleep` and then call it as a side effect on L1220: `@mock.patch(\u0027time.sleep\u0027, side_effect\u003dlambda x: ORIGINAL_SLEEP(0.001))`.\n\nIn 100 test runs this averaged to 0.0072 seconds each run.","commit_id":"c6d374635223df4f38ee0e9b02246ae66263d9ba"}]}
