Skip to content
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

Fix unit.states.test_module test failing on Python 3.11 #635

Conversation

vzhestkov
Copy link
Contributor

@vzhestkov vzhestkov commented Mar 8, 2024

What does this PR do?

Partial backport of saltstack/salt#64458

Cherry-picked commits:

In addition to upstream commits, I am adding the c7ecccb commit, which fixes a test failure that upstream seems to skip.

What issues does this PR fix or reference?

Tracks: https://github.com/SUSE/spacewalk/issues/23185

Previous Behavior

The testsuite run is failing and unable to finish with Python 3.11 as the inspect.ArgSpec was deprecated since 3.0 and no longer exists in Python 3.11

New Behavior

The same behaviour as with Python 3.10 on running the testsuite.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

s0undt3ch and others added 6 commits March 12, 2024 13:57
```
❯ 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 <[email protected]>
@vzhestkov
Copy link
Contributor Author

So this PR is making #631 useless and it can be closed, right?

@m-czernek m-czernek merged commit cdb7211 into openSUSE/release/3006.0 Mar 18, 2024
8 checks passed
meaksh pushed a commit that referenced this pull request Oct 29, 2024
* Switch to `FullArgSpec` since Py 3.11 no longer has `ArgSpec`, deprecated since Py 3.0

Signed-off-by: Pedro Algarvio <[email protected]>

* Backport `locale.getdefaultlocale()` into Salt. It's getting removed in Py 3.13

Signed-off-by: Pedro Algarvio <[email protected]>

* Stop using the deprecated `pipes` module

Signed-off-by: Pedro Algarvio <[email protected]>

* Stop using the deprecated `cgi` module.

Signed-off-by: Pedro Algarvio <[email protected]>

* Add `__getstate__` to blacklisted methods, present in Py 3.11

Signed-off-by: Pedro Algarvio <[email protected]>

* 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 <[email protected]>

---------

Signed-off-by: Pedro Algarvio <[email protected]>
Co-authored-by: Pedro Algarvio <[email protected]>
Co-authored-by: Marek Czernek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants