File fix-salt-warnings-and-testuite-for-python-3.11-635.patch of Package salt
From d0bcf2a1dbaf608c8b88d61621ed69aaf75b8630 Mon Sep 17 00:00:00 2001
From: Victor Zhestkov <vzhestkov@suse.com>
Date: Mon, 18 Mar 2024 09:15:08 +0100
Subject: [PATCH] Fix Salt warnings and testuite for Python 3.11 (#635)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Switch to `FullArgSpec` since Py 3.11 no longer has `ArgSpec`, deprecated since Py 3.0
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
* Backport `locale.getdefaultlocale()` into Salt. It's getting removed in Py 3.13
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
* Stop using the deprecated `pipes` module
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
* Stop using the deprecated `cgi` module.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
* Add `__getstate__` to blacklisted methods, present in Py 3.11
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
* Fix test_state test
* Use proper keys since Python's base64 in Py3.11 is more picky
```
❯ artifacts/salt/bin/python3
Python 3.10.11 (main, May 5 2023, 02:31:54) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64
>>> base64.b64decode("AAAAB3NzaC1kcQ9J5bYTEyZ==", validate=True)
b'\x00\x00\x00\x07ssh-dq\x0fI\xe5\xb6\x13\x13&'
```
```
$ artifacts/salt/bin/python3
Python 3.11.3 (main, May 5 2023, 02:31:40) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64
>>> base64.b64decode("AAAAB3NzaC1kcQ9J5bYTEyZ==", validate=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/testing/artifacts/salt/lib/python3.11/base64.py", line 88, in b64decode
return binascii.a2b_base64(s, strict_mode=validate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
binascii.Error: Excess data after padding
```
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
---------
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
Co-authored-by: Pedro Algarvio <palgarvio@vmware.com>
Co-authored-by: Marek Czernek <marek.czernek@suse.com>
---
tests/pytests/unit/modules/state/test_state.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/pytests/unit/modules/state/test_state.py b/tests/pytests/unit/modules/state/test_state.py
index c8fbafb6c1..e697bc3a11 100644
--- a/tests/pytests/unit/modules/state/test_state.py
+++ b/tests/pytests/unit/modules/state/test_state.py
@@ -593,7 +593,7 @@ def test_show_states_missing_sls():
chunks_mock = MagicMock(side_effect=[msg])
mock = MagicMock(side_effect=["A", None])
with patch.object(state, "_check_queue", mock), patch(
- "salt.state.HighState.compile_low_chunks", chunks_mock
+ "salt.modules.state.salt.state.HighState.compile_low_chunks", chunks_mock
):
assert state.show_low_sls("foo") == "A"
assert state.show_states("foo") == [msg[0]]
--
2.47.0