diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-03-01 16:03:21 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-03-01 16:03:47 +0100 |
| commit | 6848c33412a4f57ae4de6a05d27a5b767ce89fe1 (patch) | |
| tree | c8767ffe381ae5c09a273e7fec7d6192ae8d6827 | |
| parent | e57cde648e801c949ea342ca4ff372fa9d2ad25c (diff) | |
| download | minishell_test-1.1.1.tar.gz minishell_test-1.1.1.tar.bz2 minishell_test-1.1.1.zip | |
Fixing false positive everywhere bug1.1.1
| -rw-r--r-- | minishell_test/test/captured.py | 10 | ||||
| -rw-r--r-- | minishell_test/test/test.py | 14 | ||||
| -rw-r--r-- | setup.cfg | 2 |
3 files changed, 15 insertions, 11 deletions
diff --git a/minishell_test/test/captured.py b/minishell_test/test/captured.py index 8c217a3..c55b38e 100644 --- a/minishell_test/test/captured.py +++ b/minishell_test/test/captured.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:16:25 by charles #+# #+# # -# Updated: 2021/02/27 16:15:13 by cacharle ### ########.fr # +# Updated: 2021/03/01 16:02:26 by cacharle ### ########.fr # # # # ############################################################################ # @@ -31,13 +31,7 @@ class Captured: is_timeout: the command has timed out """ - lines = output.split('\n') - for i, line in enumerate(lines): - lines[i] = line = re.sub("line [01]: ", "", lines[i], 1) - if line.startswith(Config.shell_reference_prefix): - lines[i] = Config.minishell_prefix + line[len(Config.shell_reference_prefix):] - self.output = '\n'.join(lines) - + self.output = output self.status = status self.files_content = files_content self.is_timeout = is_timeout diff --git a/minishell_test/test/test.py b/minishell_test/test/test.py index e502588..f45b8b4 100644 --- a/minishell_test/test/test.py +++ b/minishell_test/test/test.py @@ -6,11 +6,12 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/06/16 21:48:50 by charles #+# #+# # -# Updated: 2021/02/28 10:42:37 by cacharle ### ########.fr # +# Updated: 2021/03/01 16:02:35 by cacharle ### ########.fr # # # # ############################################################################ # import os +import re import sys import subprocess from pathlib import Path @@ -50,7 +51,7 @@ class Test: self.files = files self.exports = exports self.result: Optional[Union[Result, LeakResult]] = None - self.timeout = timeout if timeout < 0 else Config.timeout_test + self.timeout = timeout if timeout > 0 else Config.timeout_test if not isinstance(hook, list): hook = [hook] if not isinstance(hook_status, list): @@ -140,6 +141,15 @@ class Test: output = hook(output) for hook_status in self.hook_status: process.returncode = hook_status(process.returncode) + + # replace reference prefix with minishell prefix + lines = output.split('\n') + for i, line in enumerate(lines): + lines[i] = line = re.sub("line [01]: ", "", lines[i], 1) + if line.startswith(Config.shell_reference_prefix): + lines[i] = Config.minishell_prefix + line[len(Config.shell_reference_prefix):] + output = '\n'.join(lines) + return Captured(output, process.returncode, files_content) @property @@ -1,6 +1,6 @@ [metadata] name = minishell_test -version = 1.1.0 +version = 1.1.1 license = GPL2 license_file = LICENSE description = test for the minishell project of school 42 |
