# ==================================================================================================================== #
# _____ ____ _ _ ____ _ #
# _ __ _ _| ____| _ \ / \ / \ | _ \ ___ _ __ ___ _ __| |_ ___ #
# | '_ \| | | | _| | | | |/ _ \ / _ \ | |_) / _ \ '_ \ / _ \| '__| __/ __| #
# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| _ < __/ |_) | (_) | | | |_\__ \ #
# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_| \_\___| .__/ \___/|_| \__|___/ #
# |_| |___/ |_| #
# ==================================================================================================================== #
# Authors: #
# Patrick Lehmann #
# #
# License: #
# ==================================================================================================================== #
# Copyright 2026-2026 Electronic Design Automation Abstraction (EDA²) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# #
# SPDX-License-Identifier: Apache-2.0 #
# ==================================================================================================================== #
#
"""
A resource package containing the XML schemas of Open Test Reporting.
`Open Test Reporting <https://github.com/ota4j-team/open-test-reporting>`__ publishes an XML schema per namespace. The
schemas of version 0.2.0 are copies of the files in the project's :file:`schema/src/main/resources` directory (release
r0.2.7), licensed under the Apache License 2.0. Each is shown, with its source, on the
:ref:`schema page <SCHEMAS/OpenTestReporting>`.
* :file:`OpenTestReporting-0.2.0.xsd` - imports the schemas below and validates both formats, used by
:class:`pyEDAA.Reports.Unittesting.OpenTestReporting.Events.Document` and
:class:`pyEDAA.Reports.Unittesting.OpenTestReporting.Hierarchy.Document`.
* :file:`core-0.2.0.xsd` - elements shared by both formats (copy).
* :file:`events-0.2.0.xsd` - the event-based format (copy).
* :file:`hierarchy-0.2.0.xsd` - the hierarchical format (copy).
* :file:`java-0.2.0.xsd` - the Java extension (copy).
* :file:`git-0.2.0.xsd` - the Git extension (copy).
* :file:`JUnit.xsd` - the JUnit Platform's extension (metadata of a test or container).
:data:`SPECIFICATIONS` names, per version of Open Test Reporting, each XML namespace and the schema defining it.
"""
from __future__ import annotations
from typing import Dict, NamedTuple
from pyTooling.Decorators import export
__all__ = ["SPECIFICATIONS"]
[docs]
@export
class Namespace(NamedTuple):
"""An XML namespace of Open Test Reporting and the XML schema in this resource package defining it."""
URI: str #: The namespace's URI, e.g. ``https://schemas.opentest4j.org/reporting/core/0.2.0``.
SchemaFile: str #: The XML schema defining the namespace, e.g. :file:`core-0.2.0.xsd`.
[docs]
@export
class Specification(NamedTuple):
"""The XML namespaces of one version of Open Test Reporting, and the XML schema importing them all."""
SchemaFile: str #: The XML schema importing the schemas of all namespaces, validating both formats.
Core: Namespace #: Elements shared by both formats.
Events: Namespace #: The event-based format.
Hierarchy: Namespace #: The hierarchical format.
Java: Namespace #: The Java extension.
Git: Namespace #: The Git extension.
JUnit: Namespace #: The JUnit Platform's extension.
SPECIFICATIONS: Dict[str, Specification] = {
"0.2.0": Specification(
SchemaFile="OpenTestReporting-0.2.0.xsd",
Core= Namespace("https://schemas.opentest4j.org/reporting/core/0.2.0", "core-0.2.0.xsd"),
Events= Namespace("https://schemas.opentest4j.org/reporting/events/0.2.0", "events-0.2.0.xsd"),
Hierarchy= Namespace("https://schemas.opentest4j.org/reporting/hierarchy/0.2.0", "hierarchy-0.2.0.xsd"),
Java= Namespace("https://schemas.opentest4j.org/reporting/java/0.2.0", "java-0.2.0.xsd"),
Git= Namespace("https://schemas.opentest4j.org/reporting/git/0.2.0", "git-0.2.0.xsd"),
JUnit= Namespace("https://schemas.junit.org/open-test-reporting", "JUnit.xsd")
)
} #: Per version of Open Test Reporting, its XML namespaces and schemas.