From f01ac49d567dcdb4083148857fe73743e8c84ad5 Mon Sep 17 00:00:00 2001 From: eeff <33566201+eeff@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:11:24 +0800 Subject: [PATCH] test: ft description support printing test arguments --- tests/ft/neuron/common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/ft/neuron/common.py b/tests/ft/neuron/common.py index ceb2b358..7caf8c3b 100644 --- a/tests/ft/neuron/common.py +++ b/tests/ft/neuron/common.py @@ -16,8 +16,11 @@ class description(object): def __call__(self, func): @wraps(func) def wrapper(*args, **kwargs): - info = "Given " + self.given + ", when " + \ - self.when + ", then " + self.then + "." + ctx = kwargs.copy() + given, when, then = eval('f"%s", f"%s", f"%s"' % ( + self.given, self.when, self.then), ctx) + info = "Given " + given + ", when " + \ + when + ", then " + then + "." print('\033[1;33;40m') print("\n" + info) print('\033[0m', end=' Result: ')