-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
test_userstring: test_find_periodic_pattern() failed on GHA Hypothesis tests on Ubuntu #110160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure how Hypothesis managed to get def test_find_periodic_pattern(self):
"""Cover the special path for periodic patterns."""
def reference_find(p, s):
for i in range(len(s)):
if s.startswith(p, i):
return i
return -1
rr = random.randrange
choices = random.choices
for _ in range(1000):
p0 = ''.join(choices('abcde', k=rr(10))) * rr(10, 20)
p = p0[:len(p0) - rr(10)] # pop off some characters
left = ''.join(choices('abcdef', k=rr(2000)))
right = ''.join(choices('abcdef', k=rr(2000)))
text = left + p + right
with self.subTest(p=p, text=text):
self.checkequal(reference_find(p, text),
text, 'find', p) |
rr = randrange(n) selects from 0 to n-1. |
Thanks for the report, @vstinner! First of all, this is not related to Hypothesis, this test just happens to fail in this test job. Yes, this test is flaky by design. Here's the minimal repro that always fails: » git patch
diff --git Lib/test/string_tests.py Lib/test/string_tests.py
index 8d210b198d2..1df4147521b 100644
--- Lib/test/string_tests.py
+++ Lib/test/string_tests.py
@@ -332,9 +332,9 @@ def reference_find(p, s):
rr = random.randrange
choices = random.choices
for _ in range(1000):
- p0 = ''.join(choices('abcde', k=rr(10))) * rr(10, 20)
- p = p0[:len(p0) - rr(10)] # pop off some characters
- left = ''.join(choices('abcdef', k=rr(2000)))
- right = ''.join(choices('abcdef', k=rr(2000)))
+ p0 = ''.join(choices('abcde', k=0)) * rr(10, 20)
+ p = p0[:len(p0) - 0] # pop off some characters
+ left = ''.join(choices('abcdef', k=0))
+ right = ''.join(choices('abcdef', k=0))
text = left + p + right
with self.subTest(p=p, text=text): Sometimes even it fails even without Since |
…sts` (pythonGH-110170) (cherry picked from commit 06faa9a) Co-authored-by: Nikita Sobolev <[email protected]>
…ests` (… (#110183) gh-110160: Fix flaky `test_find_periodic_pattern` in `string_tests` (#110170) (cherry picked from commit 06faa9a) Co-authored-by: Nikita Sobolev <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
GHA Hypothesis tests on Ubuntu:
build: https://github.com/python/cpython/actions/runs/6365753186/job/17283009565?pr=109907
Linked PRs
test_find_periodic_pattern
instring_tests
#110170test_find_periodic_pattern
instring_tests
(GH-110170) #110182test_find_periodic_pattern
instring_tests
(… #110183The text was updated successfully, but these errors were encountered: