File: py3.14_fix-timeout-wait.patch

package info (click to toggle)
python-openstacksdk 4.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 13,904 kB
  • sloc: python: 127,036; sh: 153; makefile: 23
file content (32 lines) | stat: -rw-r--r-- 1,236 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Description: py3.14: fix timeout wait
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2025-12-05

Index: python-openstacksdk/openstack/tests/unit/cloud/test_baremetal_node.py
===================================================================
--- python-openstacksdk.orig/openstack/tests/unit/cloud/test_baremetal_node.py
+++ python-openstacksdk/openstack/tests/unit/cloud/test_baremetal_node.py
@@ -17,6 +17,8 @@ test_baremetal_node
 Tests for baremetal node related operations
 """
 
+import time
+import unittest.mock as mock
 import uuid
 
 from testscenarios import load_tests_apply_scenarios as load_tests  # noqa
@@ -1829,6 +1831,13 @@ class TestBaremetalNode(base.IronicTestC
         }
         self.fake_baremetal_node['provision_state'] = 'enroll'
         manageable_node = self.fake_baremetal_node.copy()
+
+        # Patch time.monotonic to make the timeout loop deterministic for Python 3.14
+        import itertools
+        times = itertools.count(start=0, step=0.001)
+        mock_monotonic = mock.Mock(side_effect=lambda: next(times))
+        self.patch(time, 'monotonic', mock_monotonic)
+
         manageable_node['provision_state'] = 'manageable'
         self.register_uris(
             [