question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test finalized API for python environments

See original GitHub issue

Refs: https://github.com/microsoft/vscode-python/issues/19101

Complexity: 5

Create Issue


Requirements

Pre-assigning Jupyter team, but note builds are not available yet, testing begins tomorrow.

  1. Use Pre release build of the python extension
  2. Have as many types of environments as you can.
  3. Interesting types to test: Conda, Pyenv global installs, Pyenv conda envs etc.

Test APIs exposed via ProposedExtensionAPI

Example usage: Copy over contents of https://github.com/microsoft/vscode-python/blob/main/src/client/proposedApiTypes.ts#L8 as needed.

const extension = extensions.getExtension('ms-python.python');
if (extension) {
    if (!extension.isActive) {
        await extension.activate();
    }
    const api: IExtensionApi & ProposedExtensionAPI = extension.exports as IExtensionApi & ProposedExtensionAPI;
    if (api.environment) {
        const envPath =  api.environment.getActiveEnvironmentPath();
    }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
karrtikrcommented, Sep 28, 2022

So I talked with the team and decided that we’ll finalize it in an iteration or two, hope that gives Jupyter some time to adopt the API. Meanwhile we’ll still announce it in our blog posts and release notes to get additional feedback!

1reaction
IanMatthewHuffcommented, Sep 27, 2022

Right now I’m testing this with a separate extension as opposed to trying to fully adopt into Jupyter. Seemed like a fairer test of the API itself.

  • After refresh list of envs looks correct in .all
  • getActiveEnvironmentPath returns the correct Env, as well as after a change
  • After calling resolveEnvironment the env looks correct (venv, conda, global, pyenv)
  • updateActiveEnvironmentPath updates the environment
  • onDidChangeActiveEnvironmentPath fires corrected with the right arg (and doesn’t file if update parameter is already active)
  • onDidChangeEnvironments changes when adding a new Env
  • Cancellation token works on a full force refresh
Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing tests for RESTful APIs in Python using requests – part 1
One of the topics that was covered in this course is writing tests for RESTful APIs using the Python requests library and the...
Read more >
Getting Started With Testing in Python
In this in-depth tutorial, you'll see how to create Python unit tests, execute them, and find the bugs before your users do. You'll...
Read more >
venv — Creation of virtual environments — Python 3.11.1 ...
The high-level method described above makes use of a simple API which provides mechanisms for third-party virtual environment creators to customize environment ......
Read more >
Modern Test-Driven Development in Python - TestDriven.io
We started with unit tests (to test the commands and queries) followed by integration tests (to test the API endpoints), and finished with...
Read more >
Mocking API calls in Python - Auth0
The nose2 library extends the built-in Python unittest module to make testing easier. You can use unittest or other third-party libraries such ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found