Schemas
pyEDAA.Reports validates every file it reads against the schema of its format before converting it: an XML schema or a JSON Schema. It ships the schemas of the code coverage formats - e.g. Cobertura’s XML or coverage.py’s JSON report -, of the JUnit dialects and of Open Test Reporting; the schema of pyTooling’s test report comes with pyTooling. Each schema is listed here, the shipped ones with their full source, ready to read, to copy, or to download.
Available schemas
Schema |
File |
Read by |
|---|---|---|
|
||
|
strict translation of Cobertura’s DTD |
|
|
|
|
|
||
|
||
|
||
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
|
|
|
TestReport-v0.1.xsd is pyTooling’s: the reader takes it from pyTooling.Resources, and its source is on
pyTooling’s schema page.
Reaching a schema from Python
The schemas are shipped in the resource package pyEDAA.Reports.Resources. Two functions of pyTooling reach a
resource file, whether pyEDAA.Reports is installed, inside a wheel, or a checkout:
getResourceFile() returns its path, for handing the file to another tool, and
readResourceFile() returns its content, for reading it directly.
example.py
from pathlib import Path
from pyTooling.Common import getResourceFile, readResourceFile
from pyEDAA.Reports import Resources # Declare a module name that can be handed over.
schemaPath: Path = getResourceFile(Resources, "PyTest-JUnit.xsd")
schemaContent: str = readResourceFile(Resources, "PyTest-JUnit.xsd")