[1.5.x] Fixed #19546 - ensure that deprecation warnings are shown during tests

refs #18985