Commit 89394fa0 authored by canterburym's avatar canterburym
Browse files

Adds XSD test fixture

parent 30312d95
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -6,8 +6,14 @@ before_script:

stages:
  - Check ASN.1
  - Check XSD

checkASN1:
  stage: Check ASN.1
  script:
  - python3 testing/check_asn1.py

checkXSD:
    stage: Check XSD
    script:
    - python3 testing/check_xsd.py
 No newline at end of file

testing/check_xsd.py

0 → 100644
+29 −0
Original line number Diff line number Diff line
import glob
import sys
from pathlib import Path
from pprint import pprint

if __name__ == '__main__':

    if sys.version_info <= (3, 5):
        sys.exit('ERROR: You need at least Python 3.5 to run this tool')

    try:
        from lxml import etree
    except ImportError:
        sys.exit('ERROR: You need to install the Python lxml library')

    try:
        import xmlschema
    except ImportError:
        sys.exit('ERROR: You need to install the xml schema library')


    schemaFiles = glob.glob('*.xsd')

    for schemaFile in schemaFiles:
        print("Checking file: {0}".format(schemaFile), end="")
        xs = xmlschema.XMLSchema(schemaFile)
        print("OK")

    print ("{0} XSD schemas checked".format(len(schemaFiles)))
 No newline at end of file