Skip to content

Commit

Permalink
mango: increase timeout for flaky text search test with floats
Browse files Browse the repository at this point in the history
The following exception was observed on the CI (excerpt):

```
ERROR: test_floating_point_val (06-basic-text-test.NumStringTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/workspace/jenkins-cm1_PullRequests_PR-4871/24.3.4.14/build/apache-couchdb-3.3.2-e464422/src/mango/test/06-basic-text-test.py", line 583, in test_floating_point_val
    @example("NaN")
  File "/home/jenkins/workspace/jenkins-cm1_PullRequests_PR-4871/24.3.4.14/build/apache-couchdb-3.3.2-e464422/src/mango/.venv/lib/python3.9/site-packages/hypothesis/core.py", line 1190, in wrapped_test
    raise the_error_hypothesis_found
  File "/home/jenkins/workspace/jenkins-cm1_PullRequests_PR-4871/24.3.4.14/build/apache-couchdb-3.3.2-e464422/src/mango/.venv/lib/python3.9/site-packages/hypothesis/core.py", line 886, in __flaky
    raise Flaky(message)
hypothesis.errors.Flaky: Hypothesis test_floating_point_val(self=<06-basic-text-test.NumStringTests testMethod=test_floating_point_val>, f='-0x1.70cc4f85b0b06p-938') produces unreliable results: Falsified on the first call but did not on a subsequent one
[..]
Falsifying example: test_floating_point_val(
    f='-0x1.70cc4f85b0b06p-938',
    self=<06-basic-text-test.NumStringTests testMethod=test_floating_point_val>,
)
Unreliable test timings! On an initial run, this test took 255.29ms, which exceeded the deadline of 200.00ms, but on a subsequent run it took 49.44 ms, which did not. If you expect this sort of variability in your test timings, consider turning deadlines off for this test by setting deadline=None.

You can reproduce this example by temporarily adding @reproduce_failure('6.31.6', b'AAFGBwQA+pYNDaHyMw4B') as a decorator on your test case
```

As the note suggests in the report, make an attempt to fix the
issue by bumping the value of the associated default deadline.
  • Loading branch information
pgj committed Dec 5, 2023
1 parent a8b4bb2 commit 4ace5f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mango/test/06-basic-text-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import unittest
import user_docs
import math
from hypothesis import given, assume, example
from hypothesis import given, assume, example, settings
import hypothesis.strategies as st


Expand Down Expand Up @@ -580,6 +580,7 @@ def isFinite(num):
not (math.isinf(num) or math.isnan(num))

@given(f=st.floats().filter(isFinite).map(str) | st.floats().map(lambda f: f.hex()))
@settings(deadline=1000)
@example("NaN")
@example("Infinity")
def test_floating_point_val(self, f):
Expand Down

0 comments on commit 4ace5f1

Please sign in to comment.