Skip to content

Refactor .inx schema checks

Jeff Dairiki requested to merge dairiki/inkex:feature.inx-tests into master

What does the merge request do?

  • Adds a new assert method inkex.tester.inx.InxMixin.assertInxSchemaValid that can be used to validate an .inx file against the inkscape.extension.{rng,schema} XML schemas.

  • Move the schema inkscape.extension.* schema files from the top-level to the inkex/tester/ subdirectory so that they may be accessed (and distributed) as Python package data.

  • Update the InxTestCase.test_inx_files test in tests/test_inkex_inx.py to run the new .assertInxSchemaValid schema validation check on the .inx files.

  • Remove the test:validate-inx CI job. It’s now redundant since .inx schema validation is now checked by tests/test_inkex_inx.py.

  • Also adds an "executable module" script that can be used from the command line to check .inx files. This runs both the new assertInxSchemaValid check and the existing assertInxIsGood check (which checks that the parameters declared in the .inx file match those of the extension script). The script can be run, e.g.

    python -m inkex.tester.test_inx_file *.inx

    (I'm not completely sure that the inclusion of this script is really worth it.)

Note that an initial discussion about these changes was had on issue #497 (closed).

Implementation notes

Note that we now perform the schema validation from Python using lxml. This is a win since it removes the need to install the xmllint program in the test environment.

Summary for release notes

Refactor .inx file schema validation.

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history

Merge request reports