Package: ipyparallel
Followup-For: Bug #1061744
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
X-Debbugs-Cc: chris.peter...@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.peter...@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,7 @@
+     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(
++    warn_mock.assert_called_once_with(
+         'IPython could not determine IPs for {}: '
+         '[Errno -2] Name or service not known'.format(wontresolve),
+         RuntimeWarning,
diff -Nru ipyparallel-7.1.0/debian/patches/series 
ipyparallel-7.1.0/debian/patches/series
--- ipyparallel-7.1.0/debian/patches/series     2023-02-10 00:19:19.000000000 
-0800
+++ ipyparallel-7.1.0/debian/patches/series     2024-02-08 10:42:39.000000000 
-0800
@@ -5,3 +5,4 @@
 fix_docs
 fix_setuptools_import.patch
 0007-generate-code-reducer-from-CodeType-signature.patch
+python3-assert-called-once-with.patch

Reply via email to