mirror of
https://github.com/caronc/apprise-api.git
synced 2025-08-13 16:37:01 +02:00
Github Actions Test Cases (#121)
This commit is contained in:
21
.coveragerc
21
.coveragerc
@ -1,12 +1,23 @@
|
||||
[run]
|
||||
data_file = .coverage-reports/.coverage
|
||||
parallel = False
|
||||
concurrency = multiprocessing
|
||||
include = apprise_api
|
||||
omit =
|
||||
*apps.py,
|
||||
*migrations/*,
|
||||
*settings*,
|
||||
*tests/*,
|
||||
*/migrations/*,
|
||||
*/core/settings/*,
|
||||
lib/*,
|
||||
lib64/*,
|
||||
*urls.py,
|
||||
*core/wsgi.py,
|
||||
*/core/wsgi.py,
|
||||
gunicorn.conf.py,
|
||||
manage.py
|
||||
*/manage.py
|
||||
|
||||
disable_warnings = no-data-collected
|
||||
|
||||
[report]
|
||||
show_missing = True
|
||||
skip_covered = True
|
||||
skip_empty = True
|
||||
fail_under = 75.0
|
||||
|
82
.github/workflows/tests.yml
vendored
Normal file
82
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
|
||||
# On which repository actions to trigger the build.
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# Allow job to be triggered manually.
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel in-progress jobs when pushing to the same branch.
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
|
||||
tests:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
|
||||
# Run all jobs to completion (false), or cancel
|
||||
# all jobs once the first one fails (true).
|
||||
fail-fast: true
|
||||
|
||||
# Define a minimal test matrix, it will be
|
||||
# expanded using subsequent `include` items.
|
||||
matrix:
|
||||
os: ["ubuntu-latest"]
|
||||
python-version: ["3.10"]
|
||||
bare: [false]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
PYTHON: ${{ matrix.python-version }}
|
||||
BARE: ${{ matrix.bare }}
|
||||
|
||||
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.bare && '(bare)' || '' }}
|
||||
steps:
|
||||
|
||||
- name: Acquire sources
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install prerequisites (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
|
||||
- name: Install project dependencies (Baseline)
|
||||
run: |
|
||||
pip install -r requirements.txt -r dev-requirements.txt
|
||||
|
||||
# For saving resources, code style checking is
|
||||
# only invoked within the `bare` environment.
|
||||
- name: Check code style
|
||||
if: matrix.bare == true
|
||||
run: |
|
||||
flake8 apprise_api --count --show-source --statistics
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
coverage run -m pytest apprise_api
|
||||
|
||||
- name: Process coverage data
|
||||
run: |
|
||||
coverage xml
|
||||
coverage report
|
||||
|
||||
- name: Upload coverage data
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./coverage.xml
|
||||
fail_ci_if_error: false
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
@ -11,6 +11,7 @@ Apprise API was designed to easily fit into existing (and new) eco-systems that
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MHANV39UZNQ5E)
|
||||
[](https://twitter.com/l2gnux/)<br/>
|
||||
[](https://discord.gg/MMPeN2D)
|
||||
[](https://github.com/caronc/apprise-api/actions/workflows/tests.yml)
|
||||
[](https://codecov.io/github/caronc/apprise-api)
|
||||
[](https://hub.docker.com/r/caronc/apprise)
|
||||
|
||||
|
@ -491,8 +491,7 @@ class NotifyTests(SimpleTestCase):
|
||||
'urls': ', '.join([
|
||||
'mailto://user:pass@hotmail.com',
|
||||
'mailto://user:pass@gmail.com',
|
||||
],
|
||||
),
|
||||
]),
|
||||
})
|
||||
assert response.status_code == 200
|
||||
|
||||
|
@ -99,7 +99,8 @@ class StatefulNotifyTests(SimpleTestCase):
|
||||
form = NotifyForm(data=form_data)
|
||||
assert form.is_valid()
|
||||
|
||||
# Required to prevent None from being passed into self.client.post()
|
||||
# Required to prevent None from being passed into
|
||||
# self.client.post()
|
||||
del form.cleaned_data['attachment']
|
||||
|
||||
response = self.client.post(
|
||||
@ -146,7 +147,8 @@ class StatefulNotifyTests(SimpleTestCase):
|
||||
form = NotifyForm(data=form_data)
|
||||
assert form.is_valid()
|
||||
|
||||
# Required to prevent None from being passed into self.client.post()
|
||||
# Required to prevent None from being passed into
|
||||
# self.client.post()
|
||||
del form.cleaned_data['attachment']
|
||||
|
||||
response = self.client.post(
|
||||
|
@ -514,8 +514,7 @@ class GetView(View):
|
||||
_('There was no configuration found.'),
|
||||
status=ResponseCode.no_content,
|
||||
) if not json_response else JsonResponse({
|
||||
'error': _('There was no configuration found.')
|
||||
},
|
||||
'error': _('There was no configuration found.')},
|
||||
encoder=JSONEncoder,
|
||||
safe=False,
|
||||
status=ResponseCode.no_content,
|
||||
@ -548,8 +547,7 @@ class GetView(View):
|
||||
status=ResponseCode.okay,
|
||||
) if not json_response else JsonResponse({
|
||||
'format': format,
|
||||
'config': config,
|
||||
},
|
||||
'config': config},
|
||||
encoder=JSONEncoder,
|
||||
safe=False,
|
||||
status=ResponseCode.okay,
|
||||
|
@ -1,4 +0,0 @@
|
||||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE = core.settings.pytest
|
||||
addopts = --nomigrations --cov=. --cov-report=term-missing
|
||||
python_files = tests.py test_*.py *_tests.py
|
19
setup.cfg
Normal file
19
setup.cfg
Normal file
@ -0,0 +1,19 @@
|
||||
[metadata]
|
||||
# ensure LICENSE is included in wheel metadata
|
||||
license_file = LICENSE
|
||||
|
||||
[flake8]
|
||||
# We exclude packages we don't maintain
|
||||
exclude = .eggs,.tox
|
||||
ignore = E741,E722,W503,W504,W605
|
||||
statistics = true
|
||||
builtins = _
|
||||
|
||||
[aliases]
|
||||
test=pytest
|
||||
|
||||
[tool:pytest]
|
||||
DJANGO_SETTINGS_MODULE = core.settings.pytest
|
||||
addopts = --ignore=lib --ignore=lib64 --nomigrations --cov=apprise_api --cov-report=term-missing
|
||||
filterwarnings =
|
||||
once::Warning
|
Reference in New Issue
Block a user