Added tests for SCH errors.

This commit is contained in:
SET 2020-08-14 13:47:23 -03:00
parent 0485ac4f5c
commit 177ee7e627
5 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,16 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp

View File

@ -0,0 +1,3 @@
EESchema Schematic File Version 4
EELAYER END

View File

@ -0,0 +1,4 @@
EESchema Schematic File Version 4
EELAYER 30 0
$Descr A4 11693 8268

View File

@ -0,0 +1,17 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Cito

View File

@ -0,0 +1,49 @@
"""
Tests SCH errors
For debug information use:
pytest-3 --log-cli-level debug
"""
import os
import sys
# Look for the 'utils' module from where the script is running
prev_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(prev_dir))
# Utils import
from utils import context
sys.path.insert(0, os.path.dirname(prev_dir))
from kiplot.misc import CORRUPTED_SCH
def setup_ctx(test, file, error):
test = 'sch_errors_'+test
ctx = context.TestContextSCH('test_'+test, file, 'int_bom_simple_csv', None)
ctx.run(CORRUPTED_SCH)
ctx.search_err(error)
ctx.clean_up()
def test_sch_errors_no_signature():
setup_ctx('no_signature', '3Rs', 'No eeschema signature')
def test_sch_errors_no_eelayer():
setup_ctx('no_eelayer', 'error_no_eelayer', 'Missing EELAYER')
def test_sch_errors_no_eelayer_end():
setup_ctx('no_eelayer_end', 'error_no_eelayer_end', 'Missing EELAYER END')
def test_sch_errors_unknown_def():
setup_ctx('unknown_def', 'error_unknown_def', 'Unknown definition')
def test_sch_errors_eof():
setup_ctx('eof', 'error_eof', 'Unexpected end of file')