Allow skipping warnings on subclasses and deferring warning classes.
Review Request #13123 — Created June 23, 2023 and submitted
While converting Djblets to housekeeping, we hit an interesting case
where we needed to allow a deprecated base class to remain a base class
for now, but to warn when otherwise used. Furthermore, the base class
was for deprecation warnings, and needed to use a versioned warning
class when otherwise subclassed.
To handle that, two additions were made:
Subclasses of a
housekeeping_skip_warning = Trueto avoid a warning being
warning_clsparameters can now take a callable that returns a
warning class when it's time to emit. This can help avoid circular
reference issues in this particular type of case.
Unit tests pass.
Tested this with upcoming work on moving Djblets to housekeeping.
Removed an unused import.
Revision 2 (+518 -68)
Checks run (2 succeeded)