Exemplo n.º 1
0
 def get_environment(self):
     if self._environment is None:
         if self._environment_path is not None:
             self._environment = create_environment(self._environment_path, safe=False)
         else:
             self._environment = get_cached_default_environment()
     return self._environment
Exemplo n.º 2
0
def script(workspace: Workspace, uri: str) -> Script:
    """Simplifies getting jedi Script"""
    project_ = project(workspace)
    document = workspace.get_document(uri)
    return Script(
        code=document.source,
        path=document.path,
        project=project_,
        environment=get_cached_default_environment(),
    )
Exemplo n.º 3
0
    def get_environment(self):
        if self._environment is None:
            return get_cached_default_environment()

        return self._environment
Exemplo n.º 4
0
    def get_environment(self):
        if self._environment is None:
            return get_cached_default_environment()

        return self._environment
Exemplo n.º 5
0
def test_changing_venv(venv_path, monkeypatch):
    monkeypatch.setitem(os.environ, 'VIRTUAL_ENV', venv_path)
    get_cached_default_environment()
    monkeypatch.setitem(os.environ, 'VIRTUAL_ENV', sys.executable)
    assert get_cached_default_environment().executable == sys.executable
Exemplo n.º 6
0
def test_changing_venv(venv_path, monkeypatch):
    monkeypatch.setitem(os.environ, 'VIRTUAL_ENV', venv_path)
    get_cached_default_environment()
    monkeypatch.setitem(os.environ, 'VIRTUAL_ENV', sys.executable)
    assert get_cached_default_environment().executable == sys.executable