aboutsummaryrefslogtreecommitdiff
path: root/src/suite/decorator.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/suite/decorator.py')
-rw-r--r--src/suite/decorator.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/suite/decorator.py b/src/suite/decorator.py
new file mode 100644
index 0000000..55c9de6
--- /dev/null
+++ b/src/suite/decorator.py
@@ -0,0 +1,27 @@
+# ############################################################################ #
+# #
+# ::: :::::::: #
+# decorator.py :+: :+: :+: #
+# +:+ +:+ +:+ #
+# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
+# +#+#+#+#+#+ +#+ #
+# Created: 2020/09/11 12:28:00 by charles #+# #+# #
+# Updated: 2020/09/11 12:28:14 by charles ### ########.fr #
+# #
+# ############################################################################ #
+
+from suite import Suite
+from test import Test
+
+def suite(origin):
+ """ decorator for a suite function (fmt: suite_[name]) """
+
+ name = origin.__name__[len("suite_"):]
+ s = Suite(name)
+ def test_generator():
+ def test(*args, **kwargs):
+ s.add(Test(*args, **kwargs))
+ origin(test)
+ s.add_generator(test_generator)
+ Suite.available.append(s)
+ return test_generator