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

Modify Python tests to avoid patching super() #8462

Merged
merged 2 commits into from
Jun 11, 2024
Merged

Conversation

chosak
Copy link
Member

@chosak chosak commented Jun 11, 2024

The Python unit tests for FilterableListForm currently patch the builtins.super function which can break unit tests when run in a reverse or unpredictable order.

This PR updates those tests to avoid the need to patch super while still continuing to test the same functionality. I also removed an unused set_field_html_name method whose only use was removed in 2019 in 934a397.

How to test this PR

All tests continue to pass with the same coverage (actually slightly increased due to removal of unused code).

Notes and todos

This is a followup to #8461 which removed the only other patching of builtins.super in the codebase.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code follows the standards laid out in the CFPB development guidelines

The Python unit tests for FilterableListForm currently patch the
"builtins.super" function which can break unit tests when run in
a reverse or unpredictable order.

This commit updates those tests to avoid the need to patch super while
still continuing to test the same functionality.
@chosak chosak requested review from wpears and willbarton June 11, 2024 12:11
Copy link
Member

@wpears wpears left a comment

Choose a reason for hiding this comment

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

Much more readable tests as well

@chosak chosak added this pull request to the merge queue Jun 11, 2024
Merged via the queue into main with commit 44e1a06 Jun 11, 2024
12 checks passed
@chosak chosak deleted the fix/test-patch-super branch June 11, 2024 14:25
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.

2 participants