TST: Fix locale test that fails in GitHub actions
xref #29715

Looks like in GitHub actions this test is receiving an empty string for the environment variable `LOCALE_OVERRIDE` instead of `None`. Not sure why, but I guess they should be equivalent, and we don't want to fail when an empty string is provided.

The change also makes the test return a descriptive error message if an unexpected value is set in that environment variable.