Skip to content

Commit

Permalink
Merge pull request #21 from izapolsk/convert_value_to_int
Browse files Browse the repository at this point in the history
make num_sec to be converted to float
  • Loading branch information
mshriver committed Jul 30, 2019
2 parents 54bb69d + 0fc1c76 commit bf9ac1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,11 @@ def test_nonnumeric_numsec_timedelta_via_string():
with pytest.raises(TimedOutError):
wait_for(func,
timeout="2s", delay=1)


def test_str_numsec():
incman = Incrementor()
func = partial(lambda: incman.i_sleep_a_lot() > 10)
for value in "2", "1.5":
with pytest.raises(TimedOutError):
wait_for(func, num_sec=value)
2 changes: 1 addition & 1 deletion wait_for/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _get_timeout_secs(kwargs):
else:
raise ValueError("Timeout got an unknown value {}".format(timeout))
else:
num_sec = kwargs.get('num_sec', 120)
num_sec = float(kwargs.get('num_sec', 120))
return num_sec


Expand Down

0 comments on commit bf9ac1f

Please sign in to comment.