Fixed #21587 -- Raised deprecation warnings correctly.

should add `permanent=True` here (also try changing the default and seeing what other tests fail and add `permanent=True` as appropriate)