public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/python-msrest] rawhide: Fix test_client_send failure with Python 3.15
Date: Mon, 01 Jun 2026 15:46:33 GMT	[thread overview]
Message-ID: <178032879387.1.17073695815613828213.rpms-python-msrest-ed530bf88f31@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/python-msrest
            Branch : rawhide
            Commit : ed530bf88f3199790efe8f0496294bf8602527ab
            Author : Tomáš Hrnčiar <thrnciar@redhat.com>
            Date   : 2026-06-01T13:08:24+02:00
            Stats  : +95/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-msrest/c/ed530bf88f3199790efe8f0496294bf8602527ab?branch=rawhide

            Log:
            Fix test_client_send failure with Python 3.15

Python 3.15 changed unittest.mock so that directly setting
mock.call_count = 0 no longer resets the internal counter.
Use reset_mock() instead, which is the proper API for resetting
call tracking state.

Upstream is dead, so this is a downstream-only patch.

Co-authored-by: Cursor <cursoragent@cursor.com>

---
diff --git a/fix-mock-call-count-python315.patch b/fix-mock-call-count-python315.patch
new file mode 100644
index 0000000..fce7373
--- /dev/null
+++ b/fix-mock-call-count-python315.patch
@@ -0,0 +1,92 @@
+diff --git a/tests/asynctests/test_async_client.py b/tests/asynctests/test_async_client.py
+index 24a4f8f..4e7ac47 100644
+--- a/tests/asynctests/test_async_client.py
++++ b/tests/asynctests/test_async_client.py
+@@ -85,7 +85,6 @@ class TestServiceClient(object):
+ 
+         request = ClientRequest('GET', '/')
+         await client.async_send(request, stream=False)
+-        session.request.call_count = 0
+         session.request.assert_called_with(
+             'GET',
+             '/',
+@@ -100,6 +99,7 @@ class TestServiceClient(object):
+             verify=True
+         )
+         assert session.resolve_redirects.is_msrest_patched
++        session.request.reset_mock()
+ 
+         request = client.get('/', headers={'id':'1234'}, content={'Test':'Data'})
+         await client.async_send(request, stream=False)
+@@ -121,7 +121,7 @@ class TestServiceClient(object):
+             verify=True
+         )
+         assert session.request.call_count == 1
+-        session.request.call_count = 0
++        session.request.reset_mock()
+         assert session.resolve_redirects.is_msrest_patched
+ 
+         request = client.get('/', headers={'id':'1234'}, content={'Test':'Data'})
+@@ -146,14 +146,14 @@ class TestServiceClient(object):
+             verify=True
+         )
+         assert session.request.call_count == 1
+-        session.request.call_count = 0
++        session.request.reset_mock()
+         assert session.resolve_redirects.is_msrest_patched
+ 
+         session.request.side_effect = oauth2.rfc6749.errors.InvalidGrantError("test")
+         with pytest.raises(TokenExpiredError):
+             await client.async_send(request, headers={'id':'1234'}, content={'Test':'Data'}, test='value')
+         assert session.request.call_count == 2
+-        session.request.call_count = 0
++        session.request.reset_mock()
+ 
+         session.request.side_effect = ValueError("test")
+         with pytest.raises(ValueError):
+diff --git a/tests/test_client.py b/tests/test_client.py
+index 0eb0590..ad39a82 100644
+--- a/tests/test_client.py
++++ b/tests/test_client.py
+@@ -293,7 +293,6 @@ class TestServiceClient(unittest.TestCase):
+ 
+         request = ClientRequest('GET', '/')
+         client.send(request, stream=False)
+-        session.request.call_count = 0
+         session.request.assert_called_with(
+             'GET',
+             '/',
+@@ -308,6 +307,7 @@ class TestServiceClient(unittest.TestCase):
+             verify=True
+         )
+         assert session.resolve_redirects.is_msrest_patched
++        session.request.reset_mock()
+ 
+         client.send(request, headers={'id':'1234'}, content={'Test':'Data'}, stream=False)
+         session.request.assert_called_with(
+@@ -327,7 +327,7 @@ class TestServiceClient(unittest.TestCase):
+             verify=True
+         )
+         self.assertEqual(session.request.call_count, 1)
+-        session.request.call_count = 0
++        session.request.reset_mock()
+         assert session.resolve_redirects.is_msrest_patched
+ 
+         session.request.side_effect = requests.RequestException("test")
+@@ -350,14 +350,14 @@ class TestServiceClient(unittest.TestCase):
+             verify=True
+         )
+         self.assertEqual(session.request.call_count, 1)
+-        session.request.call_count = 0
++        session.request.reset_mock()
+         assert session.resolve_redirects.is_msrest_patched
+ 
+         session.request.side_effect = oauth2.rfc6749.errors.InvalidGrantError("test")
+         with self.assertRaises(TokenExpiredError):
+             client.send(request, headers={'id':'1234'}, content={'Test':'Data'}, test='value')
+         self.assertEqual(session.request.call_count, 2)
+-        session.request.call_count = 0
++        session.request.reset_mock()
+ 
+         session.request.side_effect = ValueError("test")
+         with self.assertRaises(ValueError):

diff --git a/python-msrest.spec b/python-msrest.spec
index f0947c3..10d1f01 100644
--- a/python-msrest.spec
+++ b/python-msrest.spec
@@ -14,6 +14,8 @@ Summary:        The runtime library "msrest" for AutoRest generated Python clien
 License:        MIT
 URL:            %forgeurl
 Source0:        %forgesource
+# downstream only Python 3.15 patch, upstream is dead
+Patch:          fix-mock-call-count-python315.patch
 
 BuildArch:      noarch
 
@@ -41,7 +43,7 @@ Summary:        %{summary}
 
 
 %prep
-%forgeautosetup
+%forgeautosetup -p1
 
 
 %generate_buildrequires

                 reply	other threads:[~2026-06-01 15:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178032879387.1.17073695815613828213.rpms-python-msrest-ed530bf88f31@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox