Added the name of the error to the tests when it fails.

Not just the error level.
This commit is contained in:
Salvador E. Tropea 2020-10-19 13:10:24 -03:00
parent 9c876d5783
commit 127ad89483
2 changed files with 30 additions and 2 deletions

View File

@ -29,7 +29,31 @@ PCBDRAW_ERR = 20
SVG_SCH_PRINT = 21
CORRUPTED_SCH = 22
WRONG_INSTALL = 23
error_level_to_name = ['NONE',
'INTERNAL_ERROR',
'WRONG_ARGUMENTS',
'USUPPORTED_OPTION',
'MISSING_TOOL',
'DRC_ERROR',
'EXIT_BAD_ARGS',
'EXIT_BAD_CONFIG',
'NO_PCB_FILE',
'NO_SCH_FILE',
'ERC_ERROR',
'BOM_ERROR',
'PDF_SCH_PRINT',
'PDF_PCB_PRINT',
'PLOT_ERROR',
'NO_YAML_MODULE',
'NO_PCBNEW_MODULE',
'CORRUPTED_PCB',
'KICAD2STEP_ERR',
'WONT_OVERWRITE',
'PCBDRAW_ERR',
'SVG_SCH_PRINT',
'CORRUPTED_SCH',
'WRONG_INSTALL',
]
CMD_EESCHEMA_DO = 'eeschema_do'
URL_EESCHEMA_DO = 'https://github.com/INTI-CMNB/kicad-automation-scripts'
CMD_PCBNEW_RUN_DRC = 'pcbnew_do'

View File

@ -10,6 +10,10 @@ import csv
from glob import glob
from pty import openpty
import xml.etree.ElementTree as ET
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)
from kibot.misc import (error_level_to_name)
COVERAGE_SCRIPT = 'python3-coverage'
KICAD_PCB_EXT = '.kicad_pcb'
@ -226,7 +230,7 @@ class TestContext(object):
self.err = self.err.decode()
self.out = self.err
exp_ret = 0 if ret_val is None else ret_val
assert ret_code == exp_ret, 'ret_code: {} expected {}'.format(ret_code, exp_ret)
assert ret_code == exp_ret, 'ret_code: {} ({}) expected {}'.format(ret_code, error_level_to_name[ret_code], exp_ret)
if use_a_tty:
os.close(master)
os.close(slave)