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

Default to UseAutomaticVirtualEnv in integration tests #6318

Merged
merged 3 commits into from
Feb 12, 2021

Conversation

justinvp
Copy link
Member

This way, the tests use the built-in virtual environment support by default, which is what most customers will be using. A new UsePipenv option is available to go back to using pipenv for tests.

}
} else {
if err = pt.preparePythonProjectWithPipenv(cwd); err != nil {
[]string{"python", "-m", "pip", "install", "-r", "requirements.txt"}, cwd); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this here to match what we do inside the Python SDK, running it as python -m pip install rather than pip install.

pipCmd := VirtualEnvCommand(venvDir, "python", append([]string{"-m", "pip", "install"}, arg...)...)

@stack72
Copy link
Contributor

stack72 commented Feb 11, 2021

Do we need the Pulumi.yaml file to be updated before the venv will be created or am I conflating 2 separate things here?

@justinvp
Copy link
Member Author

Do we need the Pulumi.yaml file to be updated before the venv will be created or am I conflating 2 separate things here?

No. The integration test code will handle that automatically.

projinfo.Proj.Runtime.SetOption("virtualenv", "venv")
projfile := filepath.Join(projinfo.Root, workspace.ProjectFile+".yaml")
if err = projinfo.Proj.Save(projfile); err != nil {
return errors.Wrap(err, "saving project")
}

It doesn't hurt for the Pulumi.yaml to already have it. And for the examples repo, we will want to go ahead and add it to the Pulumi.yaml for the examples (this PR that I will finish up), just to make it easier for folks who are acquiring the examples (either via cloning the repo, pulumi new <url>, or the Pulumi button). When it is specified in Pulumi.yaml and the dir doesn't exist, the CLI will create it and install deps automatically.

This way, the tests use the built-in virtual environment support by
default, which is what most customers will be using. A new `UsePipenv`
option is available to go back to using pipenv for tests.
Copy link
Contributor

@stack72 stack72 left a comment

Choose a reason for hiding this comment

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

Awesome! The set of PR tests and master should help us get some mileage around this :)

@justinvp justinvp merged commit d02c0b1 into master Feb 12, 2021
@pulumi-bot pulumi-bot deleted the justin/autovirt branch February 12, 2021 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants