Skip to content

Commit e512b02

Browse files
committed
gh-142145: relax the no-longer-quadratic test timing
1 parent 2b4feee commit e512b02

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test_minidom.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,18 @@ def testAppendChildNoQuadraticComplexity(self):
182182
children = [newdoc.createElement(f"child-{i}") for i in range(1, 2 ** 15 + 1)]
183183
element = top_element
184184

185-
start = time.time()
185+
start = time.monotonic()
186186
for child in children:
187187
element.appendChild(child)
188188
element = child
189-
end = time.time()
189+
end = time.monotonic()
190190

191191
# This example used to take at least 30 seconds.
192-
self.assertLess(end - start, 1)
192+
# Conservative assertion due to the wide variety of systems and
193+
# build configs timing based tests wind up run under.
194+
# A --with-address-sanitizer --with-pydebug build on a rpi5 still
195+
# completes this loop in <0.5 seconds.
196+
self.assertLess(end - start, 4)
193197

194198
def testSetAttributeNodeWithoutOwnerDocument(self):
195199
# regression test for gh-142754

0 commit comments

Comments
 (0)