Remove some weird changes about importing again

This commit is contained in:
Dave Halter
2019-04-09 21:48:57 +02:00
parent 255d0d9fb5
commit e61e210b41
2 changed files with 3 additions and 11 deletions

View File

@@ -138,12 +138,6 @@ class Evaluator(object):
), ),
self, self,
) )
# TODO remove this `if`
if project is not None:
# These imports are essential for Jedi and should therefore always
# be present in the module cache.
self.builtins_module
self.typing_module
def import_module(self, import_names, parent_module_context=None, def import_module(self, import_names, parent_module_context=None,
sys_path=None, load_stub=True): sys_path=None, load_stub=True):

View File

@@ -412,12 +412,10 @@ def test_pre_defined_imports_module(Script, environment, name):
path = os.path.join(root_dir, name + '.py') path = os.path.join(root_dir, name + '.py')
module = Script('', path=path)._get_module() module = Script('', path=path)._get_module()
module_cache = module.evaluator.module_cache
assert module.string_names == (name,) assert module.string_names == (name,)
m, = module_cache.get((name,))
assert m.py__file__() != path assert module.evaluator.builtins_module.py__file__() != path
assert m.evaluator.builtins_module.py__file__() != path assert module.evaluator.typing_module.py__file__() != path
assert m.evaluator.typing_module.py__file__() != path
@pytest.mark.parametrize('name', ('builtins', 'typing')) @pytest.mark.parametrize('name', ('builtins', 'typing'))