1
0
forked from VimPlug/jedi

clean out the last_* fields of sys before importing it.

The system gets confused if there were uncaught errors in previous
tests without this. Particularly, it crashes (at least 2.6) if any tests during
test_integrations were skipped.
This commit is contained in:
Claude
2015-12-14 00:49:09 +01:00
parent 0f08dc6ac6
commit be399c81c3

View File

@@ -9,6 +9,13 @@ from jedi._compatibility import is_py3
from pytest import raises
def _clear_last_exception_fields_in_sys():
import sys
sys.last_type = None
sys.last_value = None
sys.last_traceback = None
def test_preload_modules():
def check_loaded(*modules):
# +1 for None module (currently used)
@@ -20,6 +27,7 @@ def test_preload_modules():
temp_cache, cache.parser_cache = cache.parser_cache, {}
parser_cache = cache.parser_cache
_clear_last_exception_fields_in_sys()
api.preload_module('sys')
check_loaded() # compiled (c_builtin) modules shouldn't be in the cache.
api.preload_module('json', 'token')