Mock colorama if it isn't installed

This commit is contained in:
ItsDrike 2022-03-11 15:38:42 +01:00
parent d7acf9dbb0
commit dbfcaf7be5
No known key found for this signature in database
GPG key ID: B014E761034AF742

View file

@ -5,7 +5,13 @@ import sys
import argparse import argparse
from pathlib import Path from pathlib import Path
try:
import colorama import colorama
except ImportError:
from unittest.mock import Mock
class NoReprMock(Mock):
__repr__ = lambda self: ""
colorama = NoReprMock()
colorama.init(autoreset=True) colorama.init(autoreset=True)