Skip to content

Commit

Permalink
Increase timing in cache tests (#336)
Browse files Browse the repository at this point in the history
* increase sleep times a bit in cache tests

attempting to avoid stochastic test failures on MacOS CI jobs
  • Loading branch information
grlee77 committed Dec 22, 2021
1 parent f092237 commit d520a48
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/test_pyfftw_interfaces_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#

import copy
import sys

from pyfftw import interfaces, builders
import pyfftw
Expand Down Expand Up @@ -187,7 +188,7 @@ def test_cache_parent_thread_ended(self):
'''
# Firstly make sure we've exited any lingering threads from other
# tests.
time.sleep(0.1)
time.sleep(0.25)

self.assertTrue(_check_n_cache_threads_running() == 0)

Expand All @@ -201,12 +202,12 @@ def cache_parent_thread():
target=cache_parent_thread, name='PyFFTWCacheThread')
parent_t.start()

time.sleep(0.1)
time.sleep(0.25)
# Check it's running
self.assertTrue(_check_n_cache_threads_running() == 2)

parent_t.join()
time.sleep(0.1)
time.sleep(0.25)
# Check both threads have exited properly
self.assertTrue(_check_n_cache_threads_running() == 0)

Expand All @@ -215,15 +216,15 @@ def test_delete_cache_object(self):
'''
# Firstly make sure we've exited any lingering threads from other
# tests.
time.sleep(0.2)
time.sleep(0.25)
self.assertTrue(_check_n_cache_threads_running() == 0)

_cache = interfaces.cache._Cache()
time.sleep(0.2)
time.sleep(0.25)
self.assertTrue(_check_n_cache_threads_running() == 1)

del _cache
time.sleep(0.2)
time.sleep(0.25)
self.assertTrue(_check_n_cache_threads_running() == 0)

@unittest.skipIf(*miss('64'))
Expand Down Expand Up @@ -298,10 +299,8 @@ def test_objects_removed_after_keepalive(self):

keepalive_time = _cache.keepalive_time

if os.name == 'nt':
# A hack to keep appveyor from falling over here. I suspect the
# contention is too much to work properly. Either way, let's
# assume it's a windows problem for now...
if os.name == 'nt' or sys.platform == 'darwin':
# increase sleep time to address random test failures on CI
time.sleep(keepalive_time * 8)
else:
# Relax a bit more otherwise
Expand Down

0 comments on commit d520a48

Please sign in to comment.