[Tests] Adapted the KiCad config error tests to KiCad 7

This commit is contained in:
Salvador E. Tropea 2023-02-10 13:50:20 -03:00
parent 2f903633e6
commit cb58a72ebd
7 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1 @@
6.0

1
tests/data/kicad/7.0 Symbolic link
View File

@ -0,0 +1 @@
6.0

1
tests/data/kicad_err_1/7.0 Symbolic link
View File

@ -0,0 +1 @@
6.0

1
tests/data/kicad_err_2/7.0 Symbolic link
View File

@ -0,0 +1 @@
6.0

1
tests/data/kicad_ok/7.0 Symbolic link
View File

@ -0,0 +1 @@
6.0

View File

@ -90,7 +90,9 @@ def test_kicad_conf_guess_libs(monkeypatch):
""" Check no HOME and fail to load kicad_common. """ Check no HOME and fail to load kicad_common.
Also check we correctly guess the libs dir. """ Also check we correctly guess the libs dir. """
res = check_load_conf(fail=True, no_conf_path=True) res = check_load_conf(fail=True, no_conf_path=True)
if context.ki6(): if context.ki7():
name = "KICAD7_SYMBOL_DIR"
elif context.ki6():
name = "KICAD6_SYMBOL_DIR" name = "KICAD6_SYMBOL_DIR"
else: else:
name = "KICAD_SYMBOL_DIR" name = "KICAD_SYMBOL_DIR"
@ -99,7 +101,9 @@ def test_kicad_conf_guess_libs(monkeypatch):
def test_kicad_conf_lib_env(monkeypatch): def test_kicad_conf_lib_env(monkeypatch):
""" Check we can use KICAD_SYMBOL_DIR as fallback """ """ Check we can use KICAD_SYMBOL_DIR as fallback """
if context.ki6(): if context.ki7():
name = "KICAD7_SYMBOL_DIR"
elif context.ki6():
name = "KICAD6_SYMBOL_DIR" name = "KICAD6_SYMBOL_DIR"
else: else:
name = "KICAD_SYMBOL_DIR" name = "KICAD_SYMBOL_DIR"

View File

@ -27,6 +27,7 @@ if shutil.which(COVERAGE_SCRIPT) is None:
KICAD_PCB_EXT = '.kicad_pcb' KICAD_PCB_EXT = '.kicad_pcb'
KICAD_VERSION_5_99 = 5099000 KICAD_VERSION_5_99 = 5099000
KICAD_VERSION_6_0_0 = 6000000 KICAD_VERSION_6_0_0 = 6000000
KICAD_VERSION_7_0_0 = 7000000
KICAD_VERSION_5_1_7 = 5001007 KICAD_VERSION_5_1_7 = 5001007
MODE_SCH = 1 MODE_SCH = 1
MODE_PCB = 0 MODE_PCB = 0
@ -77,6 +78,10 @@ else:
logging.debug('Detected KiCad v{}.{}.{} ({})'.format(kicad_major, kicad_minor, kicad_patch, kicad_version)) logging.debug('Detected KiCad v{}.{}.{} ({})'.format(kicad_major, kicad_minor, kicad_patch, kicad_version))
def ki7():
return kicad_version >= KICAD_VERSION_7_0_0
def ki6(): def ki6():
return kicad_version >= KICAD_VERSION_5_99 return kicad_version >= KICAD_VERSION_5_99