Added update_xml test

This commit is contained in:
Salvador E. Tropea 2020-05-20 11:34:47 -03:00
parent 128906a13d
commit f7af290113
2 changed files with 29 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Tests for the preflight options
We test:
- ERC
- DRC
- XML update
For debug information use:
pytest-3 --log-cli-level debug
@ -12,6 +13,7 @@ pytest-3 --log-cli-level debug
import os
import sys
import logging
# Look for the 'utils' module from where the script is running
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(script_dir))
@ -35,3 +37,22 @@ def test_drc():
# Check all outputs are there
ctx.expect_out_file('drc_result.rpt')
ctx.clean_up()
def test_update_xml():
prj = 'bom'
ctx = context.TestContext('Update_XML', prj, 'update_xml', '')
# The XML should be created where the schematic is located
xml = os.path.abspath(os.path.join(ctx.get_board_dir(), prj+'.xml'))
os.rename(xml, xml+'-bak')
try:
ctx.run()
# Check all outputs are there
ctx.expect_out_file(prj+'.csv')
assert os.path.isfile(xml)
assert os.path.getsize(xml) > 0
logging.debug(os.path.basename(xml)+' OK')
finally:
os.remove(xml)
os.rename(xml+'-bak', xml)
ctx.clean_up()

View File

@ -0,0 +1,8 @@
# Example KiPlot config file
kiplot:
version: 1
preflight:
update_xml: true