diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-24 08:59:25 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-24 09:09:52 +0100 |
| commit | ad7233a4a5f45be6f991ed38a7351a6ef826356b (patch) | |
| tree | 7557829a45109e5ac6d83ffd8e40bcf331749f4c /minishell_test/test/test.py | |
| parent | 1399a01dc09ed1477b740bd320580ce3dacfe3cf (diff) | |
| download | minishell_test-ad7233a4a5f45be6f991ed38a7351a6ef826356b.tar.gz minishell_test-ad7233a4a5f45be6f991ed38a7351a6ef826356b.tar.bz2 minishell_test-ad7233a4a5f45be6f991ed38a7351a6ef826356b.zip | |
Fixing #17 - Incorporate the try script in the command arguments
Diffstat (limited to 'minishell_test/test/test.py')
| -rw-r--r-- | minishell_test/test/test.py | 16 |
1 files changed, 14 insertions, 2 deletions
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 <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # 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" |
