Skip to content

Commit

Permalink
Merge pull request #1194 from touilleMan/mock-clock-no-negative-jump
Browse files Browse the repository at this point in the history
Ensure MockClock autojump never feed jump with negative values
  • Loading branch information
njsmith authored Aug 20, 2019
2 parents c26a085 + 70cd348 commit 9496a59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions newsfragments/1190.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a crash that could happen when using ``MockClock`` with autojump
enabled and a non-zero rate.
2 changes: 1 addition & 1 deletion trio/testing/_mock_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async def _autojumper(self):
)
statistics = _core.current_statistics()
jump = statistics.seconds_to_next_deadline
if jump < inf:
if 0 < jump < inf:
self.jump(jump)
else:
# There are no deadlines, nothing is going to happen
Expand Down

0 comments on commit 9496a59

Please sign in to comment.