[1.5.x] Skipped deprecation warning test on Python 2.6

Refs #19546. On Python 2.6, DeprecationWarnings are visible by
default.
Backport of e6949373b from master.