aboutsummaryrefslogtreecommitdiff
path: root/src/suite
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-06 17:06:30 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-06 17:06:30 +0200
commit058491e35baa8bc73e14b48ceb765a3fe3c07e1f (patch)
tree26b44b71ea12cb6cd825783d2ddebe0902c4999a /src/suite
parent1e713de9e5013c91495e0428179947f0764409a8 (diff)
downloadminishell_test-058491e35baa8bc73e14b48ceb765a3fe3c07e1f.tar.gz
minishell_test-058491e35baa8bc73e14b48ceb765a3fe3c07e1f.tar.bz2
minishell_test-058491e35baa8bc73e14b48ceb765a3fe3c07e1f.zip
Added variable terminal size
Diffstat (limited to 'src/suite')
-rw-r--r--src/suite/suite.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/suite/suite.py b/src/suite/suite.py
index 63421f6..91cfaa4 100644
--- a/src/suite/suite.py
+++ b/src/suite/suite.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:29 by charles #+# #+# #
-# Updated: 2020/09/12 17:07:00 by charles ### ########.fr #
+# Updated: 2020/10/06 17:04:25 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -86,12 +86,21 @@ class Suite:
"""Append a test to the suite"""
self.tests.append(test)
+ BLUE_CHARS = "\033[34m"
+ CLOSE_CHARS = "\033[0m"
+
def run(self):
"""Run all test in the suite"""
if config.VERBOSE_LEVEL == 0:
print(self.name + ": ", end="")
else:
- print("{} {:#<41}".format("#" * 39, self.name + " "))
+ print("{}{} {:#<{width}}{}".format(
+ self.BLUE_CHARS,
+ "#" * (config.TERM_COLS // 2 - 1),
+ self.name + " ",
+ self.CLOSE_CHARS,
+ width=config.TERM_COLS // 2
+ ))
for t in self.tests:
t.run()
if config.VERBOSE_LEVEL == 0:
@@ -119,10 +128,10 @@ class Suite:
continue
pass_sum += pass_total
fail_sum += fail_total
- print("{:<30} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m"
- .format(s.name, pass_total, fail_total))
- print("{:<30} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m"
- .format("TOTAL", pass_sum, fail_sum))
+ print("{:.<{width}} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m"
+ .format(s.name + " ", pass_total, fail_total, width=config.TERM_COLS - 22))
+ print("{:.<{width}} \033[32m{:3} [PASS]\033[0m \033[31m{:3} [FAIL]\033[0m"
+ .format("TOTAL ", pass_sum, fail_sum, width=config.TERM_COLS - 22))
@classmethod
def save_log(cls):