https://github.com/python/cpython/commit/a696ba8b4d42fd632afc9bc88ad830a2e4cceed8
commit: a696ba8b4d42fd632afc9bc88ad830a2e4cceed8
branch: 3.13
author: Gregory P. Smith <[email protected]>
committer: gpshead <[email protected]>
date: 2025-12-21T00:22:07Z
summary:
[3.13] gh-142145: relax the no-longer-quadratic test timing (GH-143030)
(#143032)
gh-142145: relax the no-longer-quadratic test timing (#143030)
* gh-142145: relax the no-longer-quadratic test timing
* require cpu resource
(cherry picked from commit 8d2d7bb)
files:
M Lib/test/test_minidom.py
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 23b10f4644443a..69fae957ec7fc9 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -174,6 +174,7 @@ def testAppendChild(self):
self.assertEqual(dom.documentElement.childNodes[-1].data, "Hello")
dom.unlink()
+ @support.requires_resource('cpu')
def testAppendChildNoQuadraticComplexity(self):
impl = getDOMImplementation()
@@ -182,14 +183,18 @@ def testAppendChildNoQuadraticComplexity(self):
children = [newdoc.createElement(f"child-{i}") for i in range(1, 2 **
15 + 1)]
element = top_element
- start = time.time()
+ start = time.monotonic()
for child in children:
element.appendChild(child)
element = child
- end = time.time()
+ end = time.monotonic()
# This example used to take at least 30 seconds.
- self.assertLess(end - start, 10)
+ # Conservative assertion due to the wide variety of systems and
+ # build configs timing based tests wind up run under.
+ # A --with-address-sanitizer --with-pydebug build on a rpi5 still
+ # completes this loop in <0.5 seconds.
+ self.assertLess(end - start, 4)
def testSetAttributeNodeWithoutOwnerDocument(self):
# regression test for gh-142754
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]