From aa8e2c7173525b2e09c2a6908932f8f16d3e1889 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 9 Aug 2018 10:52:33 +0200 Subject: [PATCH] Get some sys completions working --- jedi/plugins/typeshed.py | 4 +--- test/test_plugin/test_stub.py | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/jedi/plugins/typeshed.py b/jedi/plugins/typeshed.py index 17c1a314..af0eeb5b 100644 --- a/jedi/plugins/typeshed.py +++ b/jedi/plugins/typeshed.py @@ -123,9 +123,7 @@ class TypeshedPlugin(BasePlugin): context_set = callback( evaluator, import_names, - parent_module_context.actual_context # noqa - if isinstance(parent_module_context, StubModuleContext) - else parent_module_context, + parent_module_context, sys_path ) # Don't use CompiledObjects, they are just annoying and don't diff --git a/test/test_plugin/test_stub.py b/test/test_plugin/test_stub.py index 468f7c6a..41a01646 100644 --- a/test/test_plugin/test_stub.py +++ b/test/test_plugin/test_stub.py @@ -81,6 +81,12 @@ def test_method(Script): assert context.class_context.py__name__() == 'str' +def test_sys(Script): + code = 'import sys; sys.exc_info()[1]' + def_, = Script(code).goto_definitions() + assert def_.name == 'BaseException' + + def test_math(Script): def_, = Script('import math; math.acos()').goto_definitions() assert def_.name == 'float'