aboutsummaryrefslogtreecommitdiff
path: root/src/suite
diff options
context:
space:
mode:
Diffstat (limited to 'src/suite')
-rw-r--r--src/suite/__init__.py4
-rw-r--r--src/suite/decorator.py5
-rw-r--r--src/suite/suite.py10
3 files changed, 11 insertions, 8 deletions
diff --git a/src/suite/__init__.py b/src/suite/__init__.py
index 55beb35..6f7f321 100644
--- a/src/suite/__init__.py
+++ b/src/suite/__init__.py
@@ -1,2 +1,2 @@
-from suite.suite import Suite
-from suite.decorator import suite
+from suite.suite import Suite # noqa: F401
+from suite.decorator import suite # noqa: F401
diff --git a/src/suite/decorator.py b/src/suite/decorator.py
index e825839..448e0a3 100644
--- a/src/suite/decorator.py
+++ b/src/suite/decorator.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 12:28:00 by charles #+# #+# #
-# Updated: 2020/09/11 16:43:00 by charles ### ########.fr #
+# Updated: 2020/09/11 20:08:27 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -14,6 +14,7 @@ from suite import Suite
from test import Test
import inspect
+
def suite(groups: [str] = [], bonus: bool = False):
def suite_wrapper(origin):
""" decorator for a suite function (fmt: suite_[name]) """
@@ -23,10 +24,12 @@ def suite(groups: [str] = [], bonus: bool = False):
name = "{}/{}".format(mod_name, origin.__name__[len("suite_"):])
s = Suite(name, groups + [mod_name], bonus)
+
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
diff --git a/src/suite/suite.py b/src/suite/suite.py
index 7f78d33..a51da65 100644
--- a/src/suite/suite.py
+++ b/src/suite/suite.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:29 by charles #+# #+# #
-# Updated: 2020/09/11 17:48:25 by charles ### ########.fr #
+# Updated: 2020/09/11 20:08:39 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -28,8 +28,8 @@ class Suite:
if not config.BONUS:
cls.available = [s for s in cls.available if not s.bonus]
cls.available = list(set(
- [s for s in cls.available if s.name in asked_names] +
- [s for s in cls.available if any([g for g in s.groups if g in asked_names])]
+ [s for s in cls.available if s.name in asked_names]
+ + [s for s in cls.available if any([g for g in s.groups if g in asked_names])]
))
for s in cls.available:
s.generate()
@@ -85,9 +85,9 @@ class Suite:
pass_sum += pass_total
fail_sum += fail_total
print("{:<30} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m"
- .format(s.name, pass_total, fail_total))
+ .format(s.name, pass_total, fail_total))
print("{:<30} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m"
- .format("TOTAL", pass_sum, fail_sum))
+ .format("TOTAL", pass_sum, fail_sum))
@classmethod
def save_log(cls):