From ced6d690044d9a8238de06371e628a598c14f12a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 10 Oct 2024 15:52:42 +0200 Subject: [PATCH] chore: ignore coverage of abstract methods (#699) Signed-off-by: Jan Kowalleck --- cyclonedx/model/dependency.py | 2 +- cyclonedx/output/__init__.py | 14 +++++++------- cyclonedx/output/json.py | 2 +- cyclonedx/schema/schema.py | 2 +- cyclonedx/validation/__init__.py | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cyclonedx/model/dependency.py b/cyclonedx/model/dependency.py index 98a5525c..4cdfe17e 100644 --- a/cyclonedx/model/dependency.py +++ b/cyclonedx/model/dependency.py @@ -113,4 +113,4 @@ class Dependable(ABC): @property @abstractmethod def bom_ref(self) -> BomRef: - ... + ... # pragma: no cover diff --git a/cyclonedx/output/__init__.py b/cyclonedx/output/__init__.py index bbc4e532..61868d43 100644 --- a/cyclonedx/output/__init__.py +++ b/cyclonedx/output/__init__.py @@ -46,12 +46,12 @@ def __init__(self, bom: 'Bom', **kwargs: int) -> None: @property @abstractmethod def schema_version(self) -> SchemaVersion: - ... + ... # pragma: no cover @property @abstractmethod def output_format(self) -> OutputFormat: - ... + ... # pragma: no cover @property def generated(self) -> bool: @@ -69,13 +69,13 @@ def set_bom(self, bom: 'Bom') -> None: @abstractmethod def generate(self, force_regeneration: bool = False) -> None: - ... + ... # pragma: no cover @abstractmethod def output_as_string(self, *, indent: Optional[Union[int, str]] = None, **kwargs: Any) -> str: - ... + ... # pragma: no cover def output_to_file(self, filename: str, allow_overwrite: bool = False, *, indent: Optional[Union[int, str]] = None, @@ -94,19 +94,19 @@ def output_to_file(self, filename: str, allow_overwrite: bool = False, *, @overload def make_outputter(bom: 'Bom', output_format: Literal[OutputFormat.JSON], schema_version: SchemaVersion) -> 'JsonOutputter': - ... + ... # pragma: no cover @overload def make_outputter(bom: 'Bom', output_format: Literal[OutputFormat.XML], schema_version: SchemaVersion) -> 'XmlOutputter': - ... + ... # pragma: no cover @overload def make_outputter(bom: 'Bom', output_format: OutputFormat, schema_version: SchemaVersion) -> Union['XmlOutputter', 'JsonOutputter']: - ... + ... # pragma: no cover def make_outputter(bom: 'Bom', output_format: OutputFormat, schema_version: SchemaVersion) -> BaseOutput: diff --git a/cyclonedx/output/json.py b/cyclonedx/output/json.py index 403197b3..bece526b 100644 --- a/cyclonedx/output/json.py +++ b/cyclonedx/output/json.py @@ -86,7 +86,7 @@ def output_as_string(self, *, @abstractmethod def _get_schema_uri(self) -> Optional[str]: - pass + ... # pragma: no cover class JsonV1Dot0(Json, SchemaVersion1Dot0): diff --git a/cyclonedx/schema/schema.py b/cyclonedx/schema/schema.py index 1dc7db27..408e8a6a 100644 --- a/cyclonedx/schema/schema.py +++ b/cyclonedx/schema/schema.py @@ -28,7 +28,7 @@ class BaseSchemaVersion(ABC, ViewType): @property @abstractmethod def schema_version_enum(self) -> SchemaVersion: - ... + ... # pragma: no cover def get_schema_version(self) -> str: return self.schema_version_enum.to_version() diff --git a/cyclonedx/validation/__init__.py b/cyclonedx/validation/__init__.py index f7028d8c..b1e973c1 100644 --- a/cyclonedx/validation/__init__.py +++ b/cyclonedx/validation/__init__.py @@ -56,7 +56,7 @@ def validate_str(self, data: str) -> Optional[ValidationError]: :retval None: if ``data`` is valid :retval ValidationError: if ``data`` is invalid """ - ... + ... # pragma: no cover class BaseSchemabasedValidator(ABC, SchemabasedValidator): @@ -76,31 +76,31 @@ def schema_version(self) -> 'SchemaVersion': @abstractmethod def output_format(self) -> OutputFormat: """Get the format.""" - ... + ... # pragma: no cover @property @abstractmethod def _schema_file(self) -> Optional[str]: """Get the schema file according to schema version.""" - ... + ... # pragma: no cover @overload def make_schemabased_validator(output_format: Literal[OutputFormat.JSON], schema_version: 'SchemaVersion' ) -> 'JsonValidator': - ... + ... # pragma: no cover @overload def make_schemabased_validator(output_format: Literal[OutputFormat.XML], schema_version: 'SchemaVersion' ) -> 'XmlValidator': - ... + ... # pragma: no cover @overload def make_schemabased_validator(output_format: OutputFormat, schema_version: 'SchemaVersion' ) -> Union['JsonValidator', 'XmlValidator']: - ... + ... # pragma: no cover def make_schemabased_validator(output_format: OutputFormat, schema_version: 'SchemaVersion'