From 63c854556ab77b1c8b305cfc3fb509f3a446435e Mon Sep 17 00:00:00 2001 From: flavien-hugs Date: Thu, 30 May 2024 13:28:19 +0000 Subject: [PATCH] add adapters exceptions --- .coveragerc | 3 +++ .github/workflows/pipeline-ci.yaml | 8 ++++++-- src/adapters/exceptions.py | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..44ec789 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,3 @@ +[run] +include = src/* +omit = tests/* diff --git a/.github/workflows/pipeline-ci.yaml b/.github/workflows/pipeline-ci.yaml index 24555b4..42c563a 100644 --- a/.github/workflows/pipeline-ci.yaml +++ b/.github/workflows/pipeline-ci.yaml @@ -54,6 +54,10 @@ jobs: - '3.x' runs-on: ubuntu-latest + env: + ACTIONS_RUNNER_DEBUG: true + ACTIONS_STEP_DEBUG: true + defaults: run: working-directory: 'src/' @@ -79,5 +83,5 @@ jobs: - name: Run tests with coverage run: | - echo "Starting tests ..." - poetry run pytest --cov --cov-report term --cov-report xml:coverage.xml tests + poetry run pytest tests/unit + poetry run coverage report diff --git a/src/adapters/exceptions.py b/src/adapters/exceptions.py index e69de29..b3afc0a 100644 --- a/src/adapters/exceptions.py +++ b/src/adapters/exceptions.py @@ -0,0 +1,10 @@ +class ExternalError(Exception): + pass + + +class DatabaseError(ExternalError): + def __init__(self, error: Exception): + self.error = error + + def __str__(self) -> str: + return str(self.error)