Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
meruyert93 committed May 3, 2024
1 parent c309d9f commit d64e9f4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ def test_validation(self):
@patch('time.time')
def test_initial_delay(self, mock_time, mock_sleep):
start_time = 100 # Fixed start time
mock_time.return_value = start_time + 0.0001 # Fixed increment
increment_time = 0.0001
mock_time.side_effect = [start_time, start_time + increment_time] # Simulate time progression

api.poll_with_specified_overhead(lambda: False, overhead_rate=0.1, max_tries=1)
try:
api.poll_with_specified_overhead(lambda: False, overhead_rate=0.1, max_tries=2)
except Exception as e:
pass # Ignore the exception for this test

expected_sleep_time = (mock_time.return_value - start_time) * 0.1
expected_sleep_time = (start_time + increment_time - start_time) * 0.1
mock_sleep.assert_called_with(expected_sleep_time)

def test_max_delay_cap(self):
Expand Down

0 comments on commit d64e9f4

Please sign in to comment.