Issue #2935755 by alexpott, Wim Leers: Add a trait to allow dynamic setting of expected deprecations (cherry picked from commit 75f9e432)