Skip to content

Commit 97667fa

Browse files
author
Fabien Coelho
committed
add tolerance
1 parent 79cec5f commit 97667fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,8 @@ def run():
684684
assert len(cache) == 32
685685
# 16 * 2 gets-no-hit + 16 * (nthreads - 1) get-with-hit
686686
hits = (nthreads - 1) / (nthreads + 1)
687-
# FIXME the hit ratio may not be deterministic?
688-
assert abs(cache.hits() - hits) < 0.01
687+
# NOTE hit ratio is not deterministic
688+
assert 0.75 * hits < cache.hits() <= hits
689689

690690
def test_threads():
691691
cache = ctu.LockedCache(ctu.StatsCache(ctu.DictCache()), threading.RLock())

0 commit comments

Comments
 (0)