You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The deadline setting is given as a number of milliseconds, but users could mistake this number for seconds or microseconds. Fortunately, Python has a timedelta type which can easily express durations - it would be good to accept timedeltas as values for the deadline setting, and convert numeric deadlines to timedeltas for unambiguous display.
That would mean:
Modifying the hypothesis._settings._validate_deadline function to accept timedeltas as well as numbers, and to return a timedelta
Make the default value for the deadline setting a timedelta
Calculate runtime in hypothesis/core.py as a timedelta, instead of a number of milliseconds, so that the comparison works (ctrl-f for deadline to find this)
Add a test in hypothesis-python/tests/cover/test_settings.py that passes a timedelta as a deadline, to check that it works and get full coverage
[optionally] create a subclass of datetime.timedelta that gives the __repr__ in terms of milliseconds, and use it in hypothesis._settings._validate_deadline (only). e.g.:
Go for it! Per our usual policy, we'll reserve this issue for you for the next week 😄
Make sure you check the contributing guide - you'll need to add your name to the list of authors, and add a RELEASE.rst file, then go through the points above. If in doubt, open a work-in-progress pull request and I'll be happy to review it and help out!
The
deadline
setting is given as a number of milliseconds, but users could mistake this number for seconds or microseconds. Fortunately, Python has atimedelta
type which can easily express durations - it would be good to accept timedeltas as values for thedeadline
setting, and convert numeric deadlines to timedeltas for unambiguous display.That would mean:
hypothesis._settings._validate_deadline
function to accept timedeltas as well as numbers, and to return a timedeltadeadline
setting a timedeltaruntime
inhypothesis/core.py
as a timedelta, instead of a number of milliseconds, so that the comparison works (ctrl-f fordeadline
to find this)hypothesis-python/tests/cover/test_settings.py
that passes a timedelta as a deadline, to check that it works and get full coveragedatetime.timedelta
that gives the__repr__
in terms of milliseconds, and use it inhypothesis._settings._validate_deadline
(only). e.g.:The text was updated successfully, but these errors were encountered: