tests: allow explicit defaults for arg types
Allow settings default values explicitly in positive_int_or_default and positive_float_or_default. It allows setting setting default 0 test retries explicitly despite it being not positive. Type: improvement Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Change-Id: Id23a9fdae0ef174eea8992c1f9fc2530aade6194
This commit is contained in:
Dmitry Valter
committed by
Dave Wallace
parent
6bd6c80f27
commit
236fae462a
@ -7,7 +7,7 @@ from vpp_qemu_utils import can_create_namespaces
|
||||
|
||||
def positive_int_or_default(default):
|
||||
def positive_integer(v):
|
||||
if v is None or v == "":
|
||||
if v is None or v == "" or int(v) == default:
|
||||
return default
|
||||
if int(v) <= 0:
|
||||
raise ValueError("value must be positive")
|
||||
@ -18,7 +18,7 @@ def positive_int_or_default(default):
|
||||
|
||||
def positive_float_or_default(default):
|
||||
def positive_float(v):
|
||||
if v is None or v == "":
|
||||
if v is None or v == "" or float(v) == default:
|
||||
return default
|
||||
if float(v) <= 0:
|
||||
raise ValueError("value must be positive")
|
||||
|
Reference in New Issue
Block a user