Allow override_feature_check(s) to be used as decorators.

Review Request #14601 — Created Sept. 9, 2025 and submitted

Information

Djblets
release-5.x

Reviewers

override_feature_check and override_feature_checks are two handy
methods that allow enabling or disabling features for unit testing.
Until now, they've been implemented solely as context managers. This
meant adding an additional layer of indentation for tests that needed to
wrap everything inside of them.

This change rewrites these two as classes which inherit from
django.test.utils.TestContextDecorator. This allows these to be used
either as a context manager or as a decorator.

  • Ran unit tests.
  • Used these in decorator form elsewhere.
Summary ID
Allow override_feature_check(s) to be used as decorators.
`override_feature_check` and `override_feature_checks` are two handy methods that allow enabling or disabling features for unit testing. Until now, they've been implemented solely as context managers. This meant adding an additional layer of indentation for tests that needed to wrap everything inside of them. This change rewrites these two as classes which inherit from `django.test.utils.TestContextDecorator`. This allows these to be used either as a context manager or as a decorator. Testing Done: - Ran unit tests. - Used these in decorator form elsewhere.
snnwlxqqnnskvxlxmumuquyorwuoquvu
Description From Last Updated

This needs to remain a Dict for this release.

chipx86chipx86

No trailing period.

chipx86chipx86

No trailing period.

chipx86chipx86
chipx86
  1. 
      
  2. djblets/features/testing.py (Diff revision 1)
     
     
    Show all issues

    This needs to remain a Dict for this release.

  3. djblets/features/tests/test_testing.py (Diff revision 1)
     
     
    Show all issues

    No trailing period.

  4. djblets/features/tests/test_testing.py (Diff revision 1)
     
     
    Show all issues

    No trailing period.

  5. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (a507821)