code: def test_permission_error(monkeypatch):
      def save(*args, **kwargs):
          was_called[0] = True  # Python 2... Use nonlocal instead
          raise PermissionError
  
      was_called = [False]
  
      monkeypatch.setattr(cache, "_save_to_file_system", save)
      with pytest.warns(Warning):
          parse(path=__file__, cache=True, diff_cache=True)
      assert was_called[0]
  
imports: import os
  import os.path
  import pytest
  import time
  from parso.cache import _CACHED_FILE_MAXIMUM_SURVIVAL, _VERSION_TAG, _get_cache_clear_lock, _get_hashed_path, _load_from_file_system, _NodeCacheItem, _remove_cache_and_update_lock, _save_to_file_system, load_module, parser_cache, try_to_save_module
  from parso._compatibility import is_pypy, PermissionError
  from parso import load_grammar
  from parso import cache
  from parso import file_io
  from parso import parse
label_desc: Use image node_id 8 for calling a global function with example usage: test_permission_error(monkeypatch) without return types