From 7a00fad22110b0d2bc03faffe469827c9496f3a7 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 5 Sep 2022 16:57:04 +0300 Subject: [PATCH] Better error messages for retry, repeat and tags `./regression.py: error: argument --retry: '...' is invalid: needs at least 2 values` instead of `./regression.py: error: argument --retry: '...' is invalid` --- testflows/_core/cli/arg/type.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testflows/_core/cli/arg/type.py b/testflows/_core/cli/arg/type.py index b354472..1246d6b 100644 --- a/testflows/_core/cli/arg/type.py +++ b/testflows/_core/cli/arg/type.py @@ -160,7 +160,7 @@ def repeat(value): pattern, count = fields option = Repeat(count=count, pattern=pattern, until=until) except Exception as e: - raise ArgumentTypeError(f"'{value}' is invalid") + raise ArgumentTypeError(f"'{value}' is invalid: {e}") return option def retry(value): @@ -182,7 +182,7 @@ def retry(value): backoff = 1 option = Retry(count=count, timeout=timeout, delay=delay, backoff=backoff, jitter=jitter, pattern=pattern) except Exception as e: - raise ArgumentTypeError(f"'{value}' is invalid") + raise ArgumentTypeError(f"'{value}' is invalid: {e}") return option def tags_filter(value): @@ -196,7 +196,7 @@ def tags_filter(value): type = "suite" option = (type, tuple(tags)) except Exception as e: - raise ArgumentTypeError(f"'{value}' is invalid") + raise ArgumentTypeError(f"'{value}' is invalid: {e}") return option def onoff(value): @@ -217,4 +217,4 @@ def trace_level(value): raise ArgumentTypeError(f"'{value}' is invalid") trace_level.choices = ["debug", "info", "warning", "error", "critical"] -trace_level.metavar = str(set(trace_level.choices)).replace(" ","").replace("'","") \ No newline at end of file +trace_level.metavar = str(set(trace_level.choices)).replace(" ","").replace("'","")