Added test for unknown prefix in units.
This commit is contained in:
parent
ae49289006
commit
41c667cb1f
|
|
@ -86,8 +86,8 @@ def get_prefix(prefix):
|
||||||
# Unknown, we shouldn't get here because the regex matched
|
# Unknown, we shouldn't get here because the regex matched
|
||||||
# BUT: I found that sometimes unexpected things happend, like mu matching micro and then we reaching this code
|
# BUT: I found that sometimes unexpected things happend, like mu matching micro and then we reaching this code
|
||||||
# Now is fixed, but I can't be sure some bizarre case is overlooked
|
# Now is fixed, but I can't be sure some bizarre case is overlooked
|
||||||
logger.error('Unknown prefix, please report') # pragma: no cover (Internal)
|
logger.error('Unknown prefix, please report')
|
||||||
return 1, '' # pragma: no cover (Internal)
|
return 1, ''
|
||||||
|
|
||||||
|
|
||||||
def group_string(group): # Return a reg-ex string for a list of values
|
def group_string(group): # Return a reg-ex string for a list of values
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ from kibot.registrable import RegOutput, RegFilter
|
||||||
from kibot.misc import (MISSING_TOOL, WRONG_INSTALL, BOM_ERROR, DRC_ERROR, ERC_ERROR, PDF_PCB_PRINT, CMD_PCBNEW_PRINT_LAYERS,
|
from kibot.misc import (MISSING_TOOL, WRONG_INSTALL, BOM_ERROR, DRC_ERROR, ERC_ERROR, PDF_PCB_PRINT, CMD_PCBNEW_PRINT_LAYERS,
|
||||||
KICAD2STEP_ERR)
|
KICAD2STEP_ERR)
|
||||||
from kibot.bom.columnlist import ColumnList
|
from kibot.bom.columnlist import ColumnList
|
||||||
|
from kibot.bom.units import get_prefix
|
||||||
from kibot.__main__ import detect_kicad
|
from kibot.__main__ import detect_kicad
|
||||||
from kibot.kicad.config import KiConf
|
from kibot.kicad.config import KiConf
|
||||||
|
|
||||||
|
|
@ -268,3 +269,9 @@ def test_step_fail(test_dir, caplog, monkeypatch):
|
||||||
assert e.type == SystemExit
|
assert e.type == SystemExit
|
||||||
assert e.value.code == KICAD2STEP_ERR
|
assert e.value.code == KICAD2STEP_ERR
|
||||||
assert "Failed to create Step file, error 10" in caplog.text
|
assert "Failed to create Step file, error 10" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
def test_unknown_prefix(caplog):
|
||||||
|
with context.cover_it(cov):
|
||||||
|
get_prefix('y')
|
||||||
|
assert 'Unknown prefix, please report' in caplog.text
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue