Add unut test CI
diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml
index 6745ffe..0de0e33 100644
--- a/.github/workflows/linters.yaml
+++ b/.github/workflows/linters.yaml
@@ -1,5 +1,15 @@
name: linters
-on: push
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - 'main'
+ tags:
+ - 'v*'
+ pull_request:
+ branches:
+ - 'main'
jobs:
super-lint:
@@ -14,3 +24,18 @@
VALIDATE_DOCKERFILE_HADOLINT: false
VALIDATE_PYTHON_MYPY: false
VALIDATE_JSCPD: false
+ pep8:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Python
+ uses: actions/setup-python@v4
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y tox
+
+ - name: Run tox -e pep8
+ run: tox -e pep8
diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml
new file mode 100644
index 0000000..946d2fc
--- /dev/null
+++ b/.github/workflows/unittests.yaml
@@ -0,0 +1,29 @@
+name: unuttests
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - 'main'
+ tags:
+ - 'v*'
+ pull_request:
+ branches:
+ - 'main'
+
+jobs:
+ unuttest:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Python
+ uses: actions/setup-python@v4
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y tox
+
+ - name: Run tox -e py3
+ run: tox -e py3
diff --git a/staffeln/common/time.py b/staffeln/common/time.py
index 79ef345..08fd5d1 100644
--- a/staffeln/common/time.py
+++ b/staffeln/common/time.py
@@ -35,7 +35,7 @@
if empty_flag:
return None
return time_params
- except: # noqa: E722
+ except Exception: # noqa: E722
return None
diff --git a/staffeln/db/sqlalchemy/api.py b/staffeln/db/sqlalchemy/api.py
index 335094e..4919f28 100644
--- a/staffeln/db/sqlalchemy/api.py
+++ b/staffeln/db/sqlalchemy/api.py
@@ -294,7 +294,7 @@
try:
return self._update(models.Backup_data, backup_id, values)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("backup resource not found.")
def create_queue(self, values):
@@ -316,7 +316,7 @@
try:
return self._update(models.Queue_data, id, values)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Queue resource not found.")
def get_queue_by_id(self, context, id):
@@ -334,13 +334,13 @@
fieldname=fieldname,
value=value,
)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Queue not found")
def soft_delete_queue(self, id):
try:
return self._soft_delete(models.Queue_data, id)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Queue Not found.")
def get_backup_by_backup_id(self, context, backup_id):
@@ -350,7 +350,7 @@
return self._get_backup(
context, fieldname="backup_id", value=backup_id
)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Backup not found with backup_id %s." % backup_id)
def _get_backup(self, context, fieldname, value):
@@ -363,13 +363,13 @@
fieldname=fieldname,
value=value,
)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Backup resource not found.")
def soft_delete_backup(self, id):
try:
return self._soft_delete(models.Backup_data, id)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Backup Not found.")
def get_report_timestamp_list(self, *args, **kwargs):
@@ -390,11 +390,11 @@
try:
return self._update(models.Report_timestamp, id, values)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Report Timestamp resource not found.")
def soft_delete_report_timestamp(self, id):
try:
return self._soft_delete(models.Report_timestamp, id)
- except: # noqa: E722
+ except Exception: # noqa: E722
LOG.error("Report Timestamp Not found.")