Skip to content

Commit

Permalink
Fix issues of #136
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhalter committed Jun 19, 2020
1 parent 3923ecf commit 58790c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions parso/_compatibility.py
Expand Up @@ -51,10 +51,10 @@ def u(string):
# Python 2.7 (both IOError + OSError)
FileNotFoundError = EnvironmentError
try:
# Python 2.7
# Python 3.3+
PermissionError = PermissionError
except NameError:
# Python 3.3+
# Python 2.7 (both IOError + OSError)
PermissionError = EnvironmentError


Expand Down
5 changes: 3 additions & 2 deletions test/test_cache.py
Expand Up @@ -178,13 +178,14 @@ def test_inactive_cache(tmpdir, isolated_parso_cache):


@skip_pypy
def test_permission_error(monkeypatch, recwarn):
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)
parse(path=__file__, cache=True, diff_cache=True)
with pytest.warns(Warning):
parse(path=__file__, cache=True, diff_cache=True)
assert was_called[0]

0 comments on commit 58790c1

Please sign in to comment.