Improved color support for identifying poor tests

This commit is contained in:
2023-07-02 18:59:31 -05:00
parent ce7ebba151
commit 1de9656856

View File

@@ -3,6 +3,7 @@
from pathlib import Path from pathlib import Path
import re import re
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from colored import Fore, Style
from typing import List, Tuple from typing import List, Tuple
CURRENT_DIR = Path(__file__).parent CURRENT_DIR = Path(__file__).parent
@@ -16,7 +17,16 @@ def main() -> None:
for directory_path in test_directories: for directory_path in test_directories:
passed, total = test_directory(directory_path) passed, total = test_directory(directory_path)
print(f"{directory_path.name}: {passed}/{total}") passed_color = Fore.GREEN
if passed != total:
if passed == 0:
passed_color = Fore.RED
else:
passed_color = Fore.YELLOW
total_color = Fore.BLUE
print(f"{directory_path.name} {passed_color}{passed}{Style.reset}/{total_color}{total}{Style.reset}")
def test_directory(path: Path) -> Tuple[int, int]: def test_directory(path: Path) -> Tuple[int, int]: