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

Sort requirements.txt files when generating Python code #16115

Merged
merged 1 commit into from
May 3, 2024

Conversation

lunaris
Copy link
Contributor

@lunaris lunaris commented May 3, 2024

A couple of our tests now generate multi-line requirements.txt whose order is dependent on that in which we enumerate packages when testing. This PR changes this so that we always sort them, meaning we can consistently check against snapshotted results (as opposed to having flaky tests that only pass when the generated order matches the one we happened to snapshot last).

Fixes #16113

@lunaris lunaris requested a review from a team as a code owner May 3, 2024 11:10
@pulumi-bot
Copy link
Contributor

Changelog

[uncommitted] (2024-05-03)

Bug Fixes

  • [programgen/python] Sort generated requirements.txt files when generating Python programs
    #16115

Copy link
Collaborator

@tgummerer tgummerer left a comment

Choose a reason for hiding this comment

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

This probably needs the tests to be run with PULUMI_ACCEPT=true to regenerate the testdata. The rest of the code changes look good to me.

Copy link
Member

@Frassle Frassle left a comment

Choose a reason for hiding this comment

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

Agree with Thomas, change looks good but testdata needs re-generating.
PULUMI_ACCEPT=1 go test ./... in pkg/codegen/python and sdk/python/cmd/pulumi-language-python should do it

@Frassle
Copy link
Member

Frassle commented May 3, 2024

Also a small update to the PR description to add that it fixes the bug Thomas raised about the tests being flaky.

@lunaris lunaris force-pushed the wjones/py-stable-reqs branch 2 times, most recently from 2c1bc2c to 286d76d Compare May 3, 2024 14:05
@lunaris lunaris added this pull request to the merge queue May 3, 2024
Merged via the queue into master with commit 6f4cb73 May 3, 2024
54 of 60 checks passed
@lunaris lunaris deleted the wjones/py-stable-reqs branch May 3, 2024 15:55
@justinvp justinvp mentioned this pull request May 6, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 6, 2024
To be merged after #16119 merges.

Tentative changelog:

- [backend] Fix concurrent reads from and writes to display resource
timer maps
  [#16101](#16101)

- [engine] Better handle property dependencies and deleted-with
relationships when pruning URNs, verifying snapshot integrity and
computing dependency graphs.
  [#16088](#16088)

- [programgen/python] Sort generated requirements.txt files when
generating Python programs
  [#16115](#16115)
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.

Python Conformance tests are flaky
4 participants