Skip to content

Commit

Permalink
Add unut test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ricolin committed Nov 1, 2024
1 parent afd834c commit d0394d6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 11 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
name: linters
on: push

on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

jobs:
super-lint:
Expand All @@ -14,3 +24,18 @@ jobs:
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
29 changes: 29 additions & 0 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion staffeln/common/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def parse_timedelta_string(time_str):
if empty_flag:
return None
return time_params
except: # noqa: E722
except Exception: # noqa: E722
return None


Expand Down
18 changes: 9 additions & 9 deletions staffeln/db/sqlalchemy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def update_backup(self, backup_id, values):

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):
Expand All @@ -316,7 +316,7 @@ def update_queue(self, id, values):

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):
Expand All @@ -334,13 +334,13 @@ def _get_queue(self, context, fieldname, value):
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):
Expand All @@ -350,7 +350,7 @@ def get_backup_by_backup_id(self, context, backup_id):
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):
Expand All @@ -363,13 +363,13 @@ def _get_backup(self, context, fieldname, value):
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):
Expand All @@ -390,11 +390,11 @@ def update_report_timestamp(self, id, values):

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.")

0 comments on commit d0394d6

Please sign in to comment.