From 904a033ae738e1c351f8fef71e2ec2418fc4db3d Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Fri, 5 Feb 2021 12:27:32 +0100 Subject: Renaming src -> minishell_test for package name, Renaming main.py -> __main__.py for package execution with python -m --- src/suite/decorator.py | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/suite/decorator.py (limited to 'src/suite/decorator.py') diff --git a/src/suite/decorator.py b/src/suite/decorator.py deleted file mode 100644 index fdc7fb6..0000000 --- a/src/suite/decorator.py +++ /dev/null @@ -1,47 +0,0 @@ -# ############################################################################ # -# # -# ::: :::::::: # -# decorator.py :+: :+: :+: # -# +:+ +:+ +:+ # -# By: charles +#+ +:+ +#+ # -# +#+#+#+#+#+ +#+ # -# Created: 2020/09/11 12:28:00 by charles #+# #+# # -# Updated: 2021/02/04 16:18:11 by charles ### ########.fr # -# # -# ############################################################################ # - -import inspect -from typing import List - -from suite import Suite -from test import Test - - -def suite(groups: List[str] = [], bonus: bool = False): # type: ignore - """Decorator generator for suites arguments""" - - def suite_wrapper(origin): - """Decorator for a suite function (fmt: suite_[name]) """ - - mod = inspect.getmodule(origin) - if mod is None: - raise NotImplementedError - mod_name = mod.__name__[len("suites."):] - name = "{}/{}".format(mod_name, origin.__name__[len("suite_"):]) - description = origin.__doc__ - if description is None: - print("You should had a doc string to the {} suite".format(name)) - description = "no description" - description = description.split("\n")[0].strip() - s = Suite(name, groups + [mod_name], bonus, description) - - def test_generator(): - def test(*args, **kwargs): - s.add(Test(*args, **kwargs)) - origin(test) - - s.generator_func = test_generator - Suite.available.append(s) - return test_generator - - return suite_wrapper -- cgit