Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pytest to use correct interpreter from getActiveInterpreter #24233

Closed
wants to merge 5 commits into from

Conversation

anthonykim1
Copy link

@anthonykim1 anthonykim1 commented Oct 3, 2024

Resolves: #24122
Related: #24190, #24127

I think the culprit was we were not passing in interpreter when we call createActivatedEnvironment.
/cc @eleanorjboyd

@anthonykim1 anthonykim1 added debt Covers everything internal: CI, testing, refactoring of the codebase, etc. bug Issue identified by VS Code Team member as probable bug area-environments Features relating to handling interpreter environments labels Oct 3, 2024
@anthonykim1 anthonykim1 removed the debt Covers everything internal: CI, testing, refactoring of the codebase, etc. label Oct 3, 2024
@@ -34,6 +35,7 @@ export class PytestTestDiscoveryAdapter implements ITestDiscoveryAdapter {
private readonly outputChannel: ITestOutputChannel,
private readonly resultResolver?: ITestResultResolver,
private readonly envVarsService?: IEnvironmentVariablesProvider,
private readonly interpreterService?: IInterpreterService,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanted to avoid dependency injection here - bit difficult since there are listener and event handlers like onDidChangeInterpreters attached.

We could also partially avoid using configService for: path = this.configService.getSettings(resource).pythonPath;

  • Rather just make an API to get getting with resource without configService would be cleaner.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to plumb the service through all layers. We can just pass the interpreter into the various layers.

@anthonykim1
Copy link
Author

Opening PR #24250 - running into lots of merge conflict.

@anthonykim1 anthonykim1 closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test discovery with pytest fails, because pytest is run in the base conda env
2 participants