Skip to content

Fix venv tests for terminal activation - #16747

Merged
Kartik Raj (karrtikr) merged 10 commits into
microsoft:mainfrom
karrtikr:unskipvenv
Jul 22, 2021
Merged

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

Conversation

@karrtikr

@karrtikr Kartik Raj (karrtikr) commented Jul 21, 2021

Copy link
Copy Markdown

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

@karrtikr Kartik Raj (karrtikr) left a comment

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.

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');

@karrtikr Kartik Raj (karrtikr) Jul 22, 2021

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.

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

@karrtikr Kartik Raj (karrtikr) Jul 22, 2021

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.

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.

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

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?

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