diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-03-02 17:48:20 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-03-02 17:48:20 +0100 |
| commit | 8fe33b3a8b61682e7a9abc7a97264d08eba7504b (patch) | |
| tree | e2204a81c13916331f145d7dd4e78110d524fbca /minishell_test/suite/suite.py | |
| parent | 7cbaf473ca385cd64978a2d6f25f2df6af76bdb9 (diff) | |
| download | minishell_test-8fe33b3a8b61682e7a9abc7a97264d08eba7504b.tar.gz minishell_test-8fe33b3a8b61682e7a9abc7a97264d08eba7504b.tar.bz2 minishell_test-8fe33b3a8b61682e7a9abc7a97264d08eba7504b.zip | |
Added Result and ResultLeak tests
Diffstat (limited to 'minishell_test/suite/suite.py')
| -rw-r--r-- | minishell_test/suite/suite.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/minishell_test/suite/suite.py b/minishell_test/suite/suite.py index b058569..2a87fbc 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/03/02 11:12:35 by cacharle ### ########.fr # +# Updated: 2021/03/02 13:17:31 by cacharle ### ########.fr # # # # ############################################################################ # @@ -129,6 +129,7 @@ class Suite: self.bonus = bonus self.generator_func: Optional[Callable] = None self.tests: List[Test] = [] + self.results: List[Result] = [] def add(self, test): """Append a test to the suite""" @@ -149,6 +150,7 @@ class Suite: self.tests = self.test[Config.range[0] : Config.range[1] + 1] for i, test in enumerate(self.tests): result = test.run() + self.results.append(result) print(result.to_string(i)) if Config.exit_first and result is not None and result.failed: return False @@ -157,10 +159,10 @@ class Suite: def total(self) -> Tuple[int, int]: """Returns the total of passed and failed tests""" passed_total = 0 - for t in self.tests: - if t.result is None: + for result in self.results: + if result is None: return (-1, -1) - if t.result.passed: + if result.passed: passed_total += 1 return passed_total, len(self.tests) - passed_total @@ -184,10 +186,8 @@ class Suite: @classmethod def save_log(cls): """Save the result of all suites to a file""" + colors.disable() with open(Config.log_path, "w") as log_file: - for s in cls.available: - for t in s.tests: - if t.result is not None and t.result.failed: - t.result.colored = False - t.result.set_colors() - log_file.write(t.result.full_diff() + '\n') + for result in self.results: + if result is not None and result.failed: + log_file.write(result.full_diff() + '\n') |
