code: def test_diehard():
      @library.python.windows.diehard(
          library.python.windows.ERRORS["ACCESS_DENIED"], tries=5
      )
      def erroneous_func(errors):
          try:
              gen_error_access_denied()
          except Exception as e:
              errors.append(e)
              raise
  
      raised_errors = []
      with pytest.raises(OSError) as errinfo:
          erroneous_func(raised_errors)
      assert errinfo.value.errno == errno.EACCES
      assert any(e.errno == errno.EACCES for e in raised_errors)
      assert raised_errors and errinfo.value == raised_errors[-1]
      if library.python.windows.on_win():
          assert len(raised_errors) == 5
      else:
          assert len(raised_errors) == 1
  
file_path: catboost/library/python/windows/ut/test_windows.py
imports: import errno
  import os
  import pytest
  import six
  import library.python.strings
  import library.python.windows
label_desc: Use image node_id 5 for calling a global function with example usage: test_diehard() without return types