File: test_schema.py

package info (click to toggle)
osinfo-db 0.20221130-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,780 kB
  • sloc: python: 1,672; sh: 344; makefile: 89
file content (18 lines) | stat: -rw-r--r-- 482 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.

import lxml.etree as ET
import pytest

from . import util


SCHEMA = util.DataFiles.schema
RELAXNG = ET.RelaxNG(ET.parse(SCHEMA.open("r")))


@pytest.mark.parametrize("path", util.DataFiles.xmls())
def test_schema(path):
    if not RELAXNG.validate(ET.parse(path.open("r"))):
        # pylint: disable=no-member
        raise AssertionError(str(RELAXNG.error_log.last_error))