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

Wait for config to be ready before accessing values #3799

Merged
merged 2 commits into from
May 2, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented May 2, 2023

I saw lots of type errors being sent to the integration test logs. After investigating I found and fixed some issues.

@@ -577,7 +577,7 @@ suite('Setup Test Suite', () => {
mockExecuteCommand.restore()
mockRunSetup.restore()
stub(config, 'isPythonExtensionUsed').returns(false)
stub(config, 'getPythonBinPath').resolves(join('python'))
stub(config, 'getPythonBinPath').returns(join('python'))
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] This was the cause of these test warnings.

@@ -389,18 +390,14 @@ export class Setup
}
}

private isDVCBeingUsedGlobally() {
Copy link
Member Author

Choose a reason for hiding this comment

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

We append the path to python to the PATH variable for the edge case that DVC is being used as a binary but with a virtual environment.

Copy link
Contributor

Choose a reason for hiding this comment

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

When I was locally testing, when I chose a global version of DVC, isPythonExtensionUsed returns true, showing the "Select Python Interpreter" on the front end:

Screenshot 2023-05-02 at 10 39 03 AM

I assumed that was just how isPythonExtensionUsed worked and added an extra check with isDVCBeingUsedGlobally, but maybe there is a bug with the function or there is something wrong about my local environment?

Copy link
Member Author

Choose a reason for hiding this comment

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

because we append the virtual environment path to the PATH environment variable it is technically being used.

@@ -374,7 +374,8 @@ export class Setup
return this.sendDataToWebview()
}

public getDvcCliDetails(): DvcCliDetails {
private async getDvcCliDetails(): Promise<DvcCliDetails> {
await this.config.isReady()
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] Need to make sure that the config has set the pythonBinPath before we try to access it.

@mattseddon mattseddon force-pushed the fix-test-warnings branch from 8fefe2d to e76244b Compare May 2, 2023 03:01
@mattseddon mattseddon marked this pull request as ready for review May 2, 2023 03:20
@mattseddon mattseddon requested review from sroy3 and julieg18 as code owners May 2, 2023 03:20
@mattseddon mattseddon enabled auto-merge (squash) May 2, 2023 20:11
@codeclimate
Copy link

codeclimate bot commented May 2, 2023

Code Climate has analyzed commit 98a89eb and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 94.7% (0.0% change).

View more on Code Climate.

@mattseddon mattseddon merged commit 695719e into main May 2, 2023
@mattseddon mattseddon deleted the fix-test-warnings branch May 2, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants