Repository navigation
fix(tests): Stop applying override_options as a class decorator - #126960
Merged
Merged
Conversation
override_options is a generator-based context manager, so using it as a class decorator replaces the TestCase with a function and pytest silently stops collecting it. Three classes were affected; their tests had drifted: - TestVSTSNewOAuth2CallbackView asserted prompt=consent on the token exchange, which #87794 moved to the authorize URL. Assert the exchange never sends it and cover the option on VSTSOAuth2LoginView instead. - UserDetailsSuperuserUpdateTest and UserDetailsStaffUpdateTest each had one test missing SUPERUSER_ORG_ID after #107774. Co-authored-by: Cursor <cursoragent@cursor.com>
hobzcalvin
marked this pull request as ready for review
October 8, 2026 21:11
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
override_optionsis a@contextmanager, so using it as a class decorator replaces theTestCasewith a plain function and pytest silently stops collecting it. Three classes on master were affected and had never been running (42 tests collected across these two files before this change, 74 after).Their option overrides now live on the test methods or in an autouse fixture. Once the classes were collected again, three tests failed because they had drifted:
TestVSTSNewOAuth2CallbackViewassertedprompt=consenton the token exchange. 🔧 chore: remove consent prompt from azure devops auth flow #87794 moved that to the authorize URL inVSTSOAuth2LoginView. The exchange test now assertspromptis never sent, the redundant "without consent" duplicate is gone, and a newTestVSTSOAuth2LoginViewcoversvsts.consent-prompton and off.UserDetailsSuperuserUpdateTest.test_superuser_with_permission_can_add_superuserandUserDetailsStaffUpdateTest.test_staff_with_permission_can_add_superusernever setSUPERUSER_ORG_IDafter ref: Replace SENTRY_DEFAULT_ORGANIZATION_ID with SUPERUSER_ORG_ID #107774, souser_can_elevatereturnedFalse. They now wrap the request inself.settings(SUPERUSER_ORG_ID=org.id)like their sibling tests.UserDetailsStaffUpdateTestalready appliedstaff.ga-rolloutthrough an autouse fixture, so its decorator is simply removed.Made with Cursor