Skip to content

Commit

Permalink
64: Add some unit test for configuration and raise coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
lfse-slafleur committed Sep 2, 2024
1 parent e05a3b9 commit ac64870
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
9 changes: 1 addition & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,11 @@ requires = [
enabled = true

[tool.pytest.ini_options]
addopts = "--cov=omotes_sdk --cov-report html --cov-report term-missing --cov-fail-under 57.5"
addopts = "--cov=omotes_sdk --cov-report html --cov-report term-missing --cov-fail-under 64"

[tool.coverage.run]
source = ["src"]

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_also = [
# Don't complain about missing code:
"\\.\\.\\.",
]

[tool.flake8]
exclude = [
'.venv/*',
Expand Down
16 changes: 8 additions & 8 deletions src/omotes_sdk/workflow_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
class WrongFieldTypeException(Exception):
"""Thrown when param_dict contains a value of the wrong type for some parameter."""

...
... # pragma: no cover


class MissingFieldException(Exception):
"""Thrown when param_dict does not contain the value for some parameter."""

...
... # pragma: no cover


@dataclass(eq=True, frozen=True)
Expand Down Expand Up @@ -66,7 +66,7 @@ def get_pb_protocol_equivalent() -> Type[
conversions. It is used to convert the workflow parameter from the Python description
to the protobuf definition in AvailableWorkflows.
"""
...
... # pragma: no cover

@abstractmethod
def to_pb_message(self) -> Union[
Expand All @@ -80,7 +80,7 @@ def to_pb_message(self) -> Union[
:return: Protobuf message representation.
"""
...
... # pragma: no cover

@classmethod
@abstractmethod
Expand All @@ -95,7 +95,7 @@ def from_pb_message(
:param parameter_type_pb: protobuf message containing the parameter type parameters.
:return: class instance.
"""
...
... # pragma: no cover

@classmethod
@abstractmethod
Expand All @@ -105,7 +105,7 @@ def from_json_config(cls, json_config: Dict) -> Self:
:param json_config: dictionary with configuration.
:return: class instance.
"""
...
... # pragma: no cover

@staticmethod
@abstractmethod
Expand All @@ -115,7 +115,7 @@ def from_pb_value(value: PBStructCompatibleTypes) -> ParamsDictValues:
Protobuf structs do not support int, datetime or timestamps natively. This function is
used to unpack the value from a protobuf-compatible datatype.
"""
...
... # pragma: no cover

@staticmethod
@abstractmethod
Expand All @@ -125,7 +125,7 @@ def to_pb_value(value: ParamsDictValues) -> PBStructCompatibleTypes:
Protobuf structs do not support int, datetime or timestamps natively. This function is
used to unpack the value to a protobuf-compatible datatype.
"""
...
... # pragma: no cover


@dataclass(eq=True, frozen=True)
Expand Down
Empty file.
9 changes: 9 additions & 0 deletions unit_test/internal/common/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import unittest

from omotes_sdk.internal.common.config import EnvRabbitMQConfig


class TestEnvRabbitMQConfig(unittest.TestCase):
def test__init__no_errors(self) -> None:
# Act / Assert
EnvRabbitMQConfig()
9 changes: 9 additions & 0 deletions unit_test/internal/worker/test_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import unittest

from omotes_sdk.internal.worker.configs import WorkerConfig


class TestWorkerConfigConfig(unittest.TestCase):
def test__init__no_errors(self) -> None:
# Act / Assert
WorkerConfig()

0 comments on commit ac64870

Please sign in to comment.