-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.11 - getdefaultlocale() deprecated #67
Comments
I'm not clear about what the fix for this is. Is it just to call |
After looking into it, I don't actually know what the correct upgrade path is. Admittedly I don't know much about how locales work. Stumbled across this bug which might be worth watching: python/cpython#82986 |
Ideally, you should just use The other solution is to just.. silence the warning and hope for a better solution before 3.13 comes out: def _getlocale():
with warnings.catch_warnings():
# temporary work-around for https://github.com/python/cpython/issues/82986
# by continuing to use getdefaultlocale() even though it has been deprecated.
warnings.simplefilter('ignore', category=DeprecationWarning)
language_code = locale.getdefaultlocale()[0]
if language_code:
return language_code
return "en-US" Perhaps inject a warning there if |
Changing : |
They may give the same for you, but that's not the case for all platforms. See python/cpython#82986 as to why this could be problematic on Windows. Please read the whole discussion here, as this was already covered. |
Fair point, we were seeing the deprecation warning when using pytest and it was only MAC users that were seeing it. |
|
Does anyone have a temp solution to hide these from the xml output? I'd love to not have 900 lines of this per run in my log. |
Add the following in your filterwarnings =
ignore:Use setlocale:DeprecationWarning:pytest_nunit |
If you are using
|
I'm going to mute the deprecation warning because |
Fixed in 1.0.5 by muting deprecation warnings in the existing call. I think the Python API will change before it is fully removed in 3.15 |
Running this package on Python 3.11 yields deprecation warnings:
See:
(I will try to provide a fix at some point if nobody else takes it up... logging the issue here for memory's sake)
The text was updated successfully, but these errors were encountered: