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

python 3.11 test failure in test_family_to_string #784

Closed
nirik opened this issue Jul 30, 2022 · 1 comment · Fixed by #791
Closed

python 3.11 test failure in test_family_to_string #784

nirik opened this issue Jul 30, 2022 · 1 comment · Fixed by #791

Comments

@nirik
Copy link

nirik commented Jul 30, 2022

Fedora rawhide has switched to python 3.11 and sshuttle fails to build due to a test:

platform linux -- Python 3.11.0b5, pytest-7.1.2, pluggy-1.0.0
rootdir: /builddir/build/BUILD/sshuttle-1.1.0, configfile: setup.cfg
plugins: cov-3.0.0, mock-3.8.2
collected 69 items
tests/client/test_firewall.py ...                                        [  4%]
tests/client/test_helpers.py ...........F                                [ 21%]
tests/client/test_methods_nat.py .........                               [ 34%]
tests/client/test_methods_pf.py .............                            [ 53%]
tests/client/test_methods_tproxy.py .........                            [ 66%]
tests/client/test_options.py .........                                   [ 79%]
tests/client/test_sdnotify.py ......                                     [ 88%]
tests/server/test_server.py .....                                        [ 95%]
tests/ssh/test_parse_hostport.py ...                                     [100%]
=================================== FAILURES ===================================
____________________________ test_family_to_string _____________________________
    def test_family_to_string():
        assert sshuttle.helpers.family_to_string(AF_INET) == "AF_INET"
        assert sshuttle.helpers.family_to_string(AF_INET6) == "AF_INET6"
        expected = 'AddressFamily.AF_UNIX'
>       assert sshuttle.helpers.family_to_string(socket.AF_UNIX) == expected
E       AssertionError: assert '1' == 'AddressFamily.AF_UNIX'
E         - AddressFamily.AF_UNIX
E         + 1
tests/client/test_helpers.py:196: AssertionError

Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=2099176

Also, they almost landed this change in python 3.10:
https://bugzilla.stage.redhat.com/show_bug.cgi?id=1949447

Python enum changes:
https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-0-alpha-7

@brianmay
Copy link
Member

Would be good to get a link to the change that broke this. Guessing maybe this did it:

bpo-40066: Enum: adjust repr() to show only enum and member name (not value, nor angle brackets) and str() to show only member name. Update and improve documentation to match.

sshuttle uses the str() method. https://github.com/sshuttle/sshuttle/blob/master/sshuttle/helpers.py#L157

I am assuming this is a enum value, not really sure.

Regardless, I don't think ssshuttle really needs AF_UNIX to work...

venthur added a commit to venthur/sshuttle that referenced this issue Aug 29, 2022
Fixed the test and only check for instance: str for families that are
not explicitly covered in `family_to_str`

closes: sshuttle#784
brianmay pushed a commit that referenced this issue Aug 29, 2022
Fixed the test and only check for instance: str for families that are
not explicitly covered in `family_to_str`

closes: #784
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 a pull request may close this issue.

2 participants