From 7081b93b8ed4f98c628400e05d22d0523f41a842 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 27 Feb 2021 12:24:37 +0100 Subject: Fixing #16 - Adding support for custom config file in user directory --- minishell_test/test/result.py | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'minishell_test/test/result.py') diff --git a/minishell_test/test/result.py b/minishell_test/test/result.py index fe465e5..b25face 100644 --- a/minishell_test/test/result.py +++ b/minishell_test/test/result.py @@ -6,15 +6,14 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:17:34 by charles #+# #+# # -# Updated: 2021/02/24 08:56:03 by cacharle ### ########.fr # +# Updated: 2021/02/27 12:10:13 by cacharle ### ########.fr # # # # ############################################################################ # -import sys import re from typing import Match, List, Optional -import minishell_test.config as config +from minishell_test import config from minishell_test.test.captured import Captured @@ -42,31 +41,18 @@ class BaseResult: def __repr__(self): """Returns a representation of the result based on the verbosity""" - if config.VERBOSE_LEVEL == 0: - return self.green('.') if self.passed else self.red('!') - if config.VERBOSE_LEVEL == 1: - printed = self._escaped_cmd[:] - if config.SHOW_RANGE: - printed = "{:2}: ".format(self.index) + printed - if len(printed) > config.TERM_COLS - 7: - printed = printed[:config.TERM_COLS - 10] + "..." - fmt = self.green("{:{width}} [PASS]") if self.passed else self.red("{:{width}} [FAIL]") - return fmt.format(printed, width=config.TERM_COLS - 7) - elif config.VERBOSE_LEVEL == 2: - return self.full_diff() - else: - raise RuntimeError("Invalid verbose level") + printed = self._escaped_cmd[:] + if config.SHOW_RANGE: + printed = "{:2}: ".format(self.index) + printed + if len(printed) > config.TERM_COLS - 7: + printed = printed[:config.TERM_COLS - 10] + "..." + fmt = self.green("{:{width}} [PASS]") if self.passed else self.red("{:{width}} [FAIL]") + return fmt.format(printed, width=config.TERM_COLS - 7) def put(self, index: int) -> None: """Print a summary of the result""" - if config.VERBOSE_LEVEL == 2 and self.passed: - return self.index = index - print(self, end="") - if config.VERBOSE_LEVEL == 0: - sys.stdout.flush() - else: - print() + print(self) def indicator(self, title: str, prefix: str) -> str: return self.bold(self.blue(prefix + " " + title)) -- cgit From c92f2be21c6be2d44cd836dd7f362e545b9a1a90 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 27 Feb 2021 14:46:21 +0100 Subject: Added make_args and check_error_messages configuration options --- minishell_test/test/result.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'minishell_test/test/result.py') diff --git a/minishell_test/test/result.py b/minishell_test/test/result.py index b25face..87eeb5d 100644 --- a/minishell_test/test/result.py +++ b/minishell_test/test/result.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:17:34 by charles #+# #+# # -# Updated: 2021/02/27 12:10:13 by cacharle ### ########.fr # +# Updated: 2021/02/27 12:28:20 by cacharle ### ########.fr # # # # ############################################################################ # -- cgit