mirror of
https://github.com/davidhalter/parso.git
synced 2026-05-25 17:58:57 +08:00
Fix issues of #136
This commit is contained in:
@@ -51,10 +51,10 @@ except NameError:
|
|||||||
# Python 2.7 (both IOError + OSError)
|
# Python 2.7 (both IOError + OSError)
|
||||||
FileNotFoundError = EnvironmentError
|
FileNotFoundError = EnvironmentError
|
||||||
try:
|
try:
|
||||||
# Python 2.7
|
# Python 3.3+
|
||||||
PermissionError = PermissionError
|
PermissionError = PermissionError
|
||||||
except NameError:
|
except NameError:
|
||||||
# Python 3.3+
|
# Python 2.7 (both IOError + OSError)
|
||||||
PermissionError = EnvironmentError
|
PermissionError = EnvironmentError
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -178,7 +178,7 @@ def test_inactive_cache(tmpdir, isolated_parso_cache):
|
|||||||
|
|
||||||
|
|
||||||
@skip_pypy
|
@skip_pypy
|
||||||
def test_permission_error(monkeypatch, recwarn):
|
def test_permission_error(monkeypatch):
|
||||||
def save(*args, **kwargs):
|
def save(*args, **kwargs):
|
||||||
was_called[0] = True # Python 2... Use nonlocal instead
|
was_called[0] = True # Python 2... Use nonlocal instead
|
||||||
raise PermissionError
|
raise PermissionError
|
||||||
@@ -186,5 +186,6 @@ def test_permission_error(monkeypatch, recwarn):
|
|||||||
was_called = [False]
|
was_called = [False]
|
||||||
|
|
||||||
monkeypatch.setattr(cache, '_save_to_file_system', save)
|
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]
|
assert was_called[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user