]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-117594: Require cpu resource to test_search_anchor_at_beginning (g… (gh...
authorDonghee Na <donghee.na@python.org>
Mon, 8 Apr 2024 00:23:55 +0000 (09:23 +0900)
committerGitHub <noreply@github.com>
Mon, 8 Apr 2024 00:23:55 +0000 (00:23 +0000)
gh-117594: Require cpu resource to test_search_anchor_at_beginning (gh-117595)

(cherry picked from commit 784623c63c45a4d13dfb04318c39fdb1ab790218)

Lib/test/test_re.py

index 656429ba8522a12b7188f52697244ef0094d77eb..e279412efbc52c85fffeda083de7b24823d65292 100644 (file)
@@ -1,7 +1,7 @@
 from test.support import (gc_collect, bigmemtest, _2G,
                           cpython_only, captured_stdout,
                           check_disallow_instantiation, is_emscripten, is_wasi,
-                          SHORT_TIMEOUT)
+                          SHORT_TIMEOUT, requires_resource)
 import locale
 import re
 import string
@@ -2217,6 +2217,9 @@ class ReTests(unittest.TestCase):
         with self.assertRaisesRegex(TypeError, "got 'type'"):
             re.search("x*", type)
 
+    # gh-117594: The test is not slow by itself, but it relies on
+    # the absolute computation time and can fail on very slow computers.
+    @requires_resource('cpu')
     def test_search_anchor_at_beginning(self):
         s = 'x'*10**7
         start = time.perf_counter()