diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 12:24:37 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-27 12:24:37 +0100 |
| commit | 7081b93b8ed4f98c628400e05d22d0523f41a842 (patch) | |
| tree | 4b945840ade4d1869ceedf94e9bca4581f096d0f /minishell_test/test/result.py | |
| parent | ad7233a4a5f45be6f991ed38a7351a6ef826356b (diff) | |
| download | minishell_test-7081b93b8ed4f98c628400e05d22d0523f41a842.tar.gz minishell_test-7081b93b8ed4f98c628400e05d22d0523f41a842.tar.bz2 minishell_test-7081b93b8ed4f98c628400e05d22d0523f41a842.zip | |
Fixing #16 - Adding support for custom config file in user directory
Diffstat (limited to 'minishell_test/test/result.py')
| -rw-r--r-- | minishell_test/test/result.py | 34 |
1 files changed, 10 insertions, 24 deletions
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 <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # 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)) |
