From 7903ad1b7c4f5f26b97bd2b0460f32ed8f1568b1 Mon Sep 17 00:00:00 2001 From: Stepan Neretin Date: Wed, 14 Aug 2024 16:10:22 +0300 Subject: [PATCH] fix locale warning DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead. rewrite using getlocale --- testgres/operations/os_ops.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testgres/operations/os_ops.py b/testgres/operations/os_ops.py index 76284049..34242040 100644 --- a/testgres/operations/os_ops.py +++ b/testgres/operations/os_ops.py @@ -20,7 +20,9 @@ def __init__(self, host='127.0.0.1', port=None, ssh_key=None, username=None): def get_default_encoding(): - return locale.getdefaultlocale()[1] or 'UTF-8' + if not hasattr(locale, 'getencoding'): + locale.getencoding = locale.getpreferredencoding + return locale.getencoding() or 'UTF-8' class OsOperations: