@mock.patch('codalab.lib.path_util.os')
  def test_make_directory_with_failures(self, mock_os):
    mock_os.path.join = os.path.join
    def mkdir_with_other_failure(path):
      raise OSError()
    mock_os.mkdir.reset_mock()
    mock_os.mkdir.side_effect = mkdir_with_other_failure
    self.assertRaises(OSError, lambda: path_util.make_directory(self.test_path))
    self.assertEqual(mock_os.mkdir.call_args_list, self.mkdir_calls)
Check that make_directory still works if the directory exists.
dataset/ETHPy150Open codalab/codalab-cli/tests/lib/path_util_test.py/PathUtilTest.test_make_directory_with_failures