Skip to content

Fix venv tests for terminal activation#16747

Merged
karrtikr merged 10 commits into
microsoft:mainfrom
karrtikr:unskipvenv
Jul 22, 2021
Merged

Fix venv tests for terminal activation#16747
karrtikr merged 10 commits into
microsoft:mainfrom
karrtikr:unskipvenv

Conversation

@karrtikr
Copy link
Copy Markdown

@karrtikr karrtikr commented Jul 21, 2021

@karrtikr karrtikr added the no-changelog No news entry required label Jul 21, 2021
@karrtikr karrtikr force-pushed the unskipvenv branch 2 times, most recently from a41ab06 to 3bb18de Compare July 21, 2021 20:38
@karrtikr karrtikr changed the title Fix venv tests Fix venv tests for terminal activation Jul 22, 2021
@karrtikr karrtikr marked this pull request as ready for review July 22, 2021 00:57
@karrtikr karrtikr requested a review from kimadeline July 22, 2021 06:43
Copy link
Copy Markdown
Author

@karrtikr karrtikr left a comment

Choose a reason for hiding this comment

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

Reasoning behind the fixes...


// Produce a list of candidate binaries to be probed by exec'ing them.
async function* getCandidates() {
const customCondaPath = getPythonSetting<string>('condaPath');
Copy link
Copy Markdown
Author

@karrtikr karrtikr Jul 22, 2021

Choose a reason for hiding this comment

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

Conda tests were only failing on Windows. One of the reasons was that conda binary was not picked up from python.condaPath, due to which we were calling getCandidatesFromRegistry among other stuff, which was slow and tests timed out.

test('Should activate with conda', async () => {
// Powershell does not work with conda by default, hence use cmd.
await terminalSettings.update(
'integrated.shell.windows',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VSCode deprecated the old setting, which is when the tests started failing as conda tests needs cmd to run, if powershell is not configured.

}
& $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaExecPath $condaExecPath
& $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaPath
& $condaExecPath init --all
Copy link
Copy Markdown
Author

@karrtikr karrtikr Jul 22, 2021

Choose a reason for hiding this comment

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

Initialize all shells for conda activation (including powershell), so conda activation tests work even when not using cmd. We do not want to rely on this too much though (conda 🤷‍♂️) so still try to use cmd in the tests.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this addition need to be repeated in all the workflow files that have a Prepare conda for venv tests step?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point 😬

let experiments: IExperimentService;
const sandbox = sinon.createSandbox();
suiteSetup(async () => {
sandbox.stub(ExperimentHelpers, 'inDiscoveryExperiment').resolves(false);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This fixed the other non-conda venv tests.

Initially, when in discovery experiment, the resolver was slow and hence the tests were timing out. That has been fixed with https://github.com/microsoft/vscode-python-internalbacklog/issues/283 and hence tests now pass upon removing this line.

}
& $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaExecPath $condaExecPath
& $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaPath
& $condaExecPath init --all
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this addition need to be repeated in all the workflow files that have a Prepare conda for venv tests step?

@karrtikr karrtikr merged commit fcdca8f into microsoft:main Jul 22, 2021
@karrtikr karrtikr deleted the unskipvenv branch July 22, 2021 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No news entry required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants