• Bug#1061744: ipyparallel ftbfs with Python 3.12 as default

    From Matthias Klose@21:1/5 to All on Mon Jan 29 12:40:01 2024
    Package: src:ipyparallel
    Version: 7.1.0-5
    Severity: serious
    Tags: sid trixie ftbfs
    User: debian-python@lists.debian.org
    Usertags: python3.12

    With python3-defaults from experimental, the package fails to build:

    [...]
    =================================== FAILURES ===================================
    _____________________________ test_disambiguate_ip _____________________________

    warn_mock = <MagicMock name='warn' id='140702045868912'>

    @mock.patch('warnings.warn')
    def test_disambiguate_ip(warn_mock):
    # garbage in, garbage out
    assert util.disambiguate_ip_address('garbage') == 'garbage'
    assert util.disambiguate_ip_address('0.0.0.0',
    socket.gethostname()) == localhost()
    wontresolve = 'this.wontresolve.dns'
    assert util.disambiguate_ip_address('0.0.0.0', wontresolve) == wontresolve
    assert warn_mock.called_once_with(
    'IPython could not determine IPs for {}: '
    '[Errno -2] Name or service not known'.format(wontresolve),
    RuntimeWarning,
    )

    ipyparallel/tests/test_util.py:21:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    _ _ _ _

    self = <MagicMock name='warn' id='140702045868912'>, name =
    'called_once_with'

    def __getattr__(self, name):
    if name in {'_mock_methods', '_mock_unsafe'}:
    raise AttributeError(name)
    elif self._mock_methods is not None:
    if name not in self._mock_methods or name in _all_magics:
    raise AttributeError("Mock object has no attribute %r"
    % name)
    elif _is_magic(name):
    raise AttributeError(name)
    if not self._mock_unsafe and (not self._mock_methods or name
    not in self._mock_methods):
    if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
    raise AttributeError(
    f"{name!r} is not a valid assertion. Use a spec "
    f"for the mock if {name!r} is meant to be an
    attribute.")
    E AttributeError: 'called_once_with' is not a valid
    assertion. Use a spec for the mock if 'called_once_with' is meant to be
    an attribute.. Did you mean: 'assert_called_once_with'?

    /usr/lib/python3.12/unittest/mock.py:663: AttributeError

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Peterson@21:1/5 to All on Sat Feb 10 04:00:01 2024
    This is a multi-part MIME message sent by reportbug.


    Package: ipyparallel
    Followup-For: Bug #1061744
    User: ubuntu-devel@lists.ubuntu.com
    Usertags: origin-ubuntu noble ubuntu-patch
    X-Debbugs-Cc: chris.peterson@canonical.com
    Control: tags -1 patch

    Dear Maintainer,


    In Ubuntu, the attached patch was applied to achieve the following:


    * Fix tests for python3.12 (LP: #2052727)

    Python3.12 added checks for mock methods prefixed with `called_` since

    assert mock.called_once()

    was a common mistake.

    Thanks for considering the patch.

    - Chris

    diff -Nru ipyparallel-7.1.0/debian/patches/python3-assert-called-once-with.patch ipyparallel-7.1.0/debian/patches/python3-assert-called-once-with.patch
    --- ipyparallel-7.1.0/debian/patches/python3-assert-called-once-with.patch 1969-12-31 16:00:00.000000000 -0800
    +++ ipyparallel-7.1.0/debian/patches/python3-assert-called-once-with.patch 2024-02-08 10:44:16.000000000 -0800
    @@ -0,0 +1,24 @@
    +Description: Fix bad test assert for python3.12
    + Python3.12 includes a check for the common mistake of:
    + assert mocked_object.called_once_with(params)
    + and now raises an attribute error instead of erroneously passing the test.
    + The correct assertion method is `assert_called_once_with`. See:
    + https://github.com/python/cpython/issues/100690
    + for more information.
    +Author: Chris Peterson <chris.peterson@canonical.com>
    +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ipyparallel/+bug/2052727 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061744 +Last-Update: 2024-02-08
    +---
    +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
    +--- a/ipyparallel/tests/test_util.py
    ++++ b/ipyparallel/tests/test_util.py
    +@@ -14,7 +14,
  • From Debian Bug Tracking System@21:1/5 to All on Sat Feb 10 04:00:01 2024
    Processing control commands:

    tags -1 patch
    Bug #1061744 [src:ipyparallel] ipyparallel ftbfs with Python 3.12 as default Added tag(s) patch.

    --
    1061744: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061744
    Debian Bug Tracking System
    Contact owner@bugs.debian.org with problems

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Arias@21:1/5 to All on Sun Feb 25 01:50:01 2024
    Hi,

    I cannot reproduce this error. Seems to be that in sid does
    not fail.

    --
    cheers,
    Emmanuel Arias

    ⢀⣴⠾⠻⢶⣦⠀
    ⣾⠁⢠⠒⠀⣿⡁ eamanu@debian.org
    ⢿⡄⠘⠷⠚⠋⠀ OpenPGP: 13796755BBC72BB8ABE2AEB5 FA9DEC5DE11C63F1 ⠈⠳⣄

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEE3lnVbvHK7ir4q61+p3sXeEcY/EFAmXajO0ACgkQ+p3sXeEc Y/EJoQ//QMhfJIdj2ezGWPnFeS1BrABi/mB56tA8DUoBZ4M2uIBiwpyxOMwK6SlN GmcoiFAEzgvGvUXSRuU7sUwLfygYX/9tABMz0lHt7PrTL2HpGgFhG2ewsrGMTJoc ukMTqXcOIZNkt77vHm71Qzy1fqTTWqYGoqkLWFZLz2lS+YbUasweh8QfU24U6oos oGWj7XOFk42xVbGBG4e774NsqsyuWtgG5likjXVw0Wpx/lCOksyR1zfsE0WXzoir CINPARgxF580k/8Bh7x8Mcapye+5QbaE9mz4IZ0dDIubZtmRPcsQJnCfWtPQxbZB DjnQ/YzfSAp6PDccrRkW0p9DrIw+ufKjA/XqFg0W7tez6WS3c2+eXVnjp7/jkk5v Xs8H4yb88nDwC2xOiNhY5W2R0sfJF/wtswNKS+3N+gRN3mKhL+m5Hy6ly7WakIni 0mmk67vuifLrPWYL8CNAC+AfY6pmUW4DmjsZVoiME9g5hF5RA9dyu/Z6cDr9A8Mk jC9s5Mv+cOpEBLaVR91h6D9xDD2ZqHLOGcUv0tKEVeQ9t9AWEDWewjH0kT9eBgYK tKuXUqUn5H7jI+Rdncfg2cZiyNSTuxEg43AvdFjSH7hflG0MeoGhmBEBesl/34DQ uO4+l6NIe++EFUS3+b4y+EDaacQ+AUVLy+1nwSTAHo8RlNinr