diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-05 18:02:45 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-05 18:02:45 +0100 |
| commit | b496ff9bb11949a4739ba44c75f2f5504a094fdb (patch) | |
| tree | 0d974a390a3787721b54dfde9278c246c698bed4 /minishell_test | |
| parent | b164430fb1fa82c705077d46cdb685de5faf6a19 (diff) | |
| download | minishell_test-b496ff9bb11949a4739ba44c75f2f5504a094fdb.tar.gz minishell_test-b496ff9bb11949a4739ba44c75f2f5504a094fdb.tar.bz2 minishell_test-b496ff9bb11949a4739ba44c75f2f5504a094fdb.zip | |
Removing annoying flake8 plugins
Diffstat (limited to 'minishell_test')
| -rw-r--r-- | minishell_test/__init__.py | 1 | ||||
| -rw-r--r-- | minishell_test/args.py | 19 | ||||
| -rw-r--r-- | minishell_test/suite/decorator.py | 4 | ||||
| -rw-r--r-- | minishell_test/suite/suite.py | 12 | ||||
| -rw-r--r-- | minishell_test/suites/flow.py | 4 | ||||
| -rw-r--r-- | minishell_test/suites/path.py | 8 | ||||
| -rw-r--r-- | minishell_test/test/captured.py | 8 | ||||
| -rw-r--r-- | minishell_test/test/result.py | 20 | ||||
| -rw-r--r-- | minishell_test/test/test.py | 4 |
9 files changed, 37 insertions, 43 deletions
diff --git a/minishell_test/__init__.py b/minishell_test/__init__.py index 8b13789..e69de29 100644 --- a/minishell_test/__init__.py +++ b/minishell_test/__init__.py @@ -1 +0,0 @@ - diff --git a/minishell_test/args.py b/minishell_test/args.py index b7fcca6..fb12841 100644 --- a/minishell_test/args.py +++ b/minishell_test/args.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:32 by charles #+# #+# # -# Updated: 2021/01/11 22:20:16 by charles ### ########.fr # +# Updated: 2021/02/05 17:14:41 by charles ### ########.fr # # # # ############################################################################ # @@ -18,19 +18,12 @@ def parse_args(): """Parse command line arguments""" parser = argparse.ArgumentParser( - description=textwrap.dedent(r""" - ___ ____ _ _ _ _ _ _ - | \/ (_) (_) | | | | | | | | | - | . . |_ _ __ _ ___| |__ ___| | | | |_ ___ ___| |_ - | |\/| | | '_ \| / __| '_ \ / _ \ | | | __/ _ \/ __| __| - | | | | | | | | \__ \ | | | __/ | | | || __/\__ \ |_ - \_| |_/_|_| |_|_|___/_| |_|\___|_|_| \__\___||___/\__| - """), + description="Test for the minishell project of school 42.", formatter_class=argparse.RawTextHelpFormatter, - epilog=textwrap.dedent("""\ - Signal handling is not tested - There is a commented glob suite in src/suites/preprocess.py. - Good luck handling `*'.*'`. + epilog=textwrap.dedent(""" + Made by cacharle + https://github.com/cacharle + https://cacharle.xyz """) ) parser.add_argument( diff --git a/minishell_test/suite/decorator.py b/minishell_test/suite/decorator.py index a843bc4..45f96b6 100644 --- a/minishell_test/suite/decorator.py +++ b/minishell_test/suite/decorator.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:28:00 by charles #+# #+# # -# Updated: 2021/02/05 14:50:41 by charles ### ########.fr # +# Updated: 2021/02/05 17:44:25 by charles ### ########.fr # # # # ############################################################################ # @@ -26,7 +26,7 @@ def suite(groups: List[str] = [], bonus: bool = False): # type: ignore mod = inspect.getmodule(origin) if mod is None: raise NotImplementedError - mod_name = mod.__name__[len("suites."):] + mod_name = mod.__name__[len("minishell_test.suites."):] name = "{}/{}".format(mod_name, origin.__name__[len("suite_"):]) description = origin.__doc__ if description is None: diff --git a/minishell_test/suite/suite.py b/minishell_test/suite/suite.py index df342a0..8fd39bf 100644 --- a/minishell_test/suite/suite.py +++ b/minishell_test/suite/suite.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:29 by charles #+# #+# # -# Updated: 2021/02/05 14:24:36 by charles ### ########.fr # +# Updated: 2021/02/05 18:01:33 by charles ### ########.fr # # # # ############################################################################ # @@ -44,9 +44,9 @@ class Suite: names.append(name) continue matches = [n for n in suite_names - if n.find("/") != -1 - and n[n.find("/") + 1:].startswith(name) - or n.startswith(name)] + if n.find("/") != -1 and + n[n.find("/") + 1:].startswith(name) or + n.startswith(name)] if len(matches) == 1: names.append(matches[0]) elif len(matches) != 0 and all(n.startswith(name) for n in matches): @@ -63,8 +63,8 @@ class Suite: sys.exit(1) cls.available = list(set( - [s for s in cls.available if s.name in names] - + [s for s in cls.available if any(g for g in s.groups if g in names)] + [s for s in cls.available if s.name in names] + + [s for s in cls.available if any(g for g in s.groups if g in names)] )) cls.available.sort(key=lambda s: s.name) for s in cls.available: diff --git a/minishell_test/suites/flow.py b/minishell_test/suites/flow.py index 90aef7f..ed5fd03 100644 --- a/minishell_test/suites/flow.py +++ b/minishell_test/suites/flow.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:52 by charles #+# #+# # -# Updated: 2021/02/05 15:11:21 by charles ### ########.fr # +# Updated: 2021/02/05 17:40:00 by charles ### ########.fr # # # # ############################################################################ # @@ -20,6 +20,7 @@ from minishell_test.hooks import ( error_eof_to_expected_token ) + @suite() def suite_end(test): """ `;` tests """ @@ -58,6 +59,7 @@ def suite_end(test): test("ls " + 40 * " ; ls" + ";", setup="touch a b c") test("ls " + 80 * " ; ls" + ";", setup="touch a b c") + @suite() def suite_pipe(test): """ `|` tests """ diff --git a/minishell_test/suites/path.py b/minishell_test/suites/path.py index b350168..fa67d9a 100644 --- a/minishell_test/suites/path.py +++ b/minishell_test/suites/path.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/09 15:12:58 by charles #+# #+# # -# Updated: 2021/02/05 14:50:19 by charles ### ########.fr # +# Updated: 2021/02/05 17:47:32 by charles ### ########.fr # # # # ############################################################################ # @@ -22,9 +22,9 @@ def suite_path(test): if whoami_path is None: print("Couldn't find `whoami` in your PATH: Skipping suite") return - mode_fmt = ("mkdir path && cp " - + whoami_path - + " ./path/a && chmod {} ./path/a") + mode_fmt = ("mkdir path && cp " + + whoami_path + + " ./path/a && chmod {} ./path/a") test("a", setup=mode_fmt.format("000"), exports={"PATH": "path"}) test("a", setup=mode_fmt.format("001"), exports={"PATH": "path"}) test("a", setup=mode_fmt.format("002"), exports={"PATH": "path"}) diff --git a/minishell_test/test/captured.py b/minishell_test/test/captured.py index d24bcdf..7db9739 100644 --- a/minishell_test/test/captured.py +++ b/minishell_test/test/captured.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:16:25 by charles #+# #+# # -# Updated: 2021/02/05 14:55:31 by charles ### ########.fr # +# Updated: 2021/02/05 17:47:10 by charles ### ########.fr # # # # ############################################################################ # @@ -46,9 +46,9 @@ class Captured: raise NotImplementedError if self.is_timeout: return self.is_timeout == other.is_timeout - return (self.output == other.output - and self.status == other.status - and all(x == y for x, y in zip(self.files_content, other.files_content))) + return (self.output == other.output and + self.status == other.status and + all(x == y for x, y in zip(self.files_content, other.files_content))) @staticmethod def timeout(): diff --git a/minishell_test/test/result.py b/minishell_test/test/result.py index ec0f192..9769527 100644 --- a/minishell_test/test/result.py +++ b/minishell_test/test/result.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:17:34 by charles #+# #+# # -# Updated: 2021/02/05 14:55:23 by charles ### ########.fr # +# Updated: 2021/02/05 17:46:30 by charles ### ########.fr # # # # ############################################################################ # @@ -168,11 +168,11 @@ class Result(BaseResult): return "" file_header = self.indicator("FILE {}".format(file_name), "|#") + '\n' return ( - file_header - + self.expected_header - + self.cat_e(expected) - + self.actual_header - + self.cat_e(actual) + file_header + + self.expected_header + + self.cat_e(expected) + + self.actual_header + + self.cat_e(actual) ) def files_diff(self): @@ -194,10 +194,10 @@ class Result(BaseResult): .format(self.expected.status, self.actual.status), "| " ) + '\n' if self.expected.output != self.actual.output: - out += (self.expected_header - + self.cat_e(self.expected.output) - + self.actual_header - + self.cat_e(self.actual.output)) + out += (self.expected_header + + self.cat_e(self.expected.output) + + self.actual_header + + self.cat_e(self.actual.output)) return out def full_diff(self) -> str: diff --git a/minishell_test/test/test.py b/minishell_test/test/test.py index a6305b9..7b6a118 100644 --- a/minishell_test/test/test.py +++ b/minishell_test/test/test.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/06/16 21:48:50 by charles #+# #+# # -# Updated: 2021/02/05 14:42:26 by charles ### ########.fr # +# Updated: 2021/02/05 17:39:44 by charles ### ########.fr # # # # ############################################################################ # @@ -20,7 +20,7 @@ from minishell_test.test.captured import Captured from minishell_test.test.result import Result, LeakResult import minishell_test.sandbox as sandbox -HookType = Union[Callable[[str], str], List[Callable[[str], str]]] +HookType = Union[Callable[[str], str], List[Callable[[str], str]]] HookStatusType = Union[Callable[[int], int], List[Callable[[int], int]]] |
