Fix Python2 test failures in certain locales
Check that we can also get the locale, after setting it, without raising an Exception.

- [x] closes #22129
- [x] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
