Added test for missing colorama module.

This commit is contained in:
Salvador E. Tropea 2021-01-27 12:55:19 -03:00
parent 01459ce85e
commit ce387ac423
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#!/usr/bin/python3
import os
import sys
# Setup the path to load local kibot module
prev_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if prev_dir not in sys.path:
sys.path.insert(0, prev_dir)
# Force the pcbnew module load to fail
sys.modules['colorama'] = None
# Import the module to test
from kibot import log
log.set_domain('kibot')
logger = log.init()
logger.error('Testing 1 2 3')

View File

@ -534,3 +534,10 @@ def test_no_yaml():
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_yaml_error.py')]
ctx.do_run(cmd, NO_YAML_MODULE)
ctx.search_err('No yaml module for Python, install python3-yaml')
def test_no_colorama():
ctx = context.TestContext('test_no_colorama', 'bom', 'bom', '')
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_colorama_error.py')]
ctx.do_run(cmd, use_a_tty=True)
ctx.search_err(r'\[31m.\[1mERROR:Testing 1 2 3')