From be399c81c309c4d9e98f814ab55cc23e36a6a164 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 14 Dec 2015 00:49:09 +0100 Subject: [PATCH] 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. --- test/test_api/test_api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_api/test_api.py b/test/test_api/test_api.py index 926f41a2..72ff57e3 100644 --- a/test/test_api/test_api.py +++ b/test/test_api/test_api.py @@ -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')