Added test for KiCad < 5.1.6

This commit is contained in:
Salvador E. Tropea 2021-01-29 12:15:46 -03:00
parent e6163ae5aa
commit 55c988bb66
3 changed files with 18 additions and 3 deletions

View File

@ -0,0 +1,2 @@
def GetKicadConfigPath():
return 'bogus'

View File

@ -2,11 +2,17 @@
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__))))
cur_dir = os.path.dirname(os.path.abspath(__file__))
prev_dir = os.path.dirname(os.path.dirname(cur_dir))
if prev_dir not in sys.path:
sys.path.insert(0, prev_dir)
# Force the pcbnew module load to fail
sys.modules['pcbnew'] = None
if len(sys.argv) > 1 and sys.argv[1] == 'fake':
fake_dir = os.path.join(cur_dir, 'fake_pcbnew')
if fake_dir not in sys.path:
sys.path.insert(0, fake_dir)
else:
# Force the pcbnew module load to fail
sys.modules['pcbnew'] = None
# Import the module to test
from kibot.__main__ import detect_kicad
detect_kicad()

View File

@ -537,6 +537,13 @@ def test_no_pcbnew():
ctx.search_err('PYTHONPATH')
def test_old_pcbnew():
ctx = context.TestContext('test_old_pcbnew', 'bom', 'bom', '')
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_pcbnew_error.py'), 'fake']
ctx.do_run(cmd)
ctx.search_err('Unknown KiCad version, please install KiCad 5.1.6 or newer')
def test_no_yaml():
ctx = context.TestContext('test_no_yaml', 'bom', 'bom', '')
cmd = [os.path.abspath(os.path.dirname(os.path.abspath(__file__))+'/force_yaml_error.py')]