From 2beec09d776eaf262259c2a7acd0ada6bbc36cf3 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 17 May 2017 19:12:20 -0400 Subject: [PATCH] Currently modifying the cache for parso doctests is not needed. So just remove it. --- conftest.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/conftest.py b/conftest.py index 8500f03..83a120f 100644 --- a/conftest.py +++ b/conftest.py @@ -9,42 +9,17 @@ from parso import cache collect_ignore = ["setup.py"] -# The following hooks (pytest_configure, pytest_unconfigure) are used -# to modify `cache._default_cache_path` because `clean_parso_cache` -# has no effect during doctests. Without these hooks, doctests uses -# user's cache (e.g., ~/.cache/parso/). We should remove this -# workaround once the problem is fixed in py.test. -# -# See (this was back when parso was part of jedi): -# - https://github.com/davidhalter/jedi/pull/168 -# - https://bitbucket.org/hpk42/pytest/issue/275/ - -parso_cache_directory_orig = None -parso_cache_directory_temp = None - - def pytest_addoption(parser): parser.addoption("--warning-is-error", action='store_true', help="Warnings are treated as errors.") def pytest_configure(config): - global parso_cache_directory_orig, parso_cache_directory_temp - parso_cache_directory_orig = cache._default_cache_path - parso_cache_directory_temp = tempfile.mkdtemp(prefix='parso-test-') - cache._default_cache_path = parso_cache_directory_temp - if config.option.warning_is_error: import warnings warnings.simplefilter("error") -def pytest_unconfigure(config): - global parso_cache_directory_orig, parso_cache_directory_temp - cache._default_cache_path = parso_cache_directory_orig - shutil.rmtree(parso_cache_directory_temp) - - @pytest.fixture(scope='session') def clean_parso_cache(request): """ @@ -58,7 +33,7 @@ def clean_parso_cache(request): """ old = cache._default_cache_path tmp = tempfile.mkdtemp(prefix='parso-test-') - cache.default_cache_path = tmp + cache._default_cache_path = tmp @request.addfinalizer def restore():