From ad7233a4a5f45be6f991ed38a7351a6ef826356b Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 24 Feb 2021 08:59:25 +0100 Subject: Fixing #17 - Incorporate the try script in the command arguments --- minishell_test/test/result.py | 2 +- minishell_test/test/test.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'minishell_test/test') diff --git a/minishell_test/test/result.py b/minishell_test/test/result.py index 9769527..fe465e5 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/05 17:46:30 by charles ### ########.fr # +# Updated: 2021/02/24 08:56:03 by cacharle ### ########.fr # # # # ############################################################################ # diff --git a/minishell_test/test/test.py b/minishell_test/test/test.py index ff1f389..ff60522 100644 --- a/minishell_test/test/test.py +++ b/minishell_test/test/test.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/06/16 21:48:50 by charles #+# #+# # -# Updated: 2021/02/05 18:35:12 by charles ### ########.fr # +# Updated: 2021/02/24 09:09:39 by cacharle ### ########.fr # # # # ############################################################################ # @@ -144,7 +144,7 @@ class Test: return Captured(output, process.returncode, files_content) @property - def full_cmd(self): + def full_cmd(self) -> str: """ Return the command prefixed by the setup and exports """ s = self.cmd if len(self.exports) != 0: @@ -153,3 +153,15 @@ class Test: if self.setup != "": s = "[SETUP {}] {}".format(self.setup, s) return s + + @classmethod + def try_run(cls, cmd: str) -> str: + config.VERBOSE_LEVEL = 2 + test = Test(cmd) + test.run(0) + if isinstance(test.result, LeakResult): + return test.result.captured.output + elif isinstance(test.result, Result): + return test.result.actual.output + else: + return "No output" -- cgit