summaryrefslogtreecommitdiffstats
path: root/test/config.py
diff options
context:
space:
mode:
authorDmitry Valter <d-valter@yandex-team.com>2023-10-11 20:37:04 +0000
committerDave Wallace <dwallacelf@gmail.com>2023-11-03 20:13:58 +0000
commit236fae462a4ee799b3f05d4b2aff641d5c9486a6 (patch)
tree732d7ba4327ae2e7767451db7f9e6ffdc182b136 /test/config.py
parent6bd6c80f27c708f72aef1d850e48deaef832477e (diff)
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
Diffstat (limited to 'test/config.py')
-rw-r--r--test/config.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/config.py b/test/config.py
index 511c3c6ae09..2fa93ddef3b 100644
--- a/test/config.py
+++ b/test/config.py
@@ -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")