Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Address code inspections (#1)
Browse files Browse the repository at this point in the history
* Addresses code quality inspections

* Adds codacy code coverage reporter

* Bumps patch number
  • Loading branch information
djperrefort authored Jun 1, 2022
1 parent c3c6bdb commit fe6ac08
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/Unittests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Run Tests
name: Test Suite

on:
workflow_dispatch:
push:

jobs:
python_tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -14,7 +15,7 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
Expand All @@ -33,9 +34,27 @@ jobs:
coverage run -m unittest
coverage report
coverage xml -o report_${{ matrix.python-version }}.xml
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: report_${{ matrix.python-version }}.xml

# Report test coverage to codacy for the python version being tested
- name: Report partial coverage results
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l Python -r report_${{ matrix.python-version }}.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

codacy-coverage-reporter:
name: Report code coverage
runs-on: ubuntu-latest
needs: python_tests
steps:

# Tell codacy we are done reporting test coverage
- name: Finish reporting coverage
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
2 changes: 1 addition & 1 deletion django_easy_error/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

from django.conf import settings

__version__ = '1.0.0'
__version__ = '1.0.1'
__author__ = 'Daniel Perrefort'

# Allow reloading of the module without Django raising an error
Expand Down
7 changes: 5 additions & 2 deletions django_easy_error/handlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Handlers are used to process the routing of HTTP errors to the correct
"""Request handlers for different error codes.
Handlers are used to process the routing of HTTP errors to the correct
template. Handler objects are provided for each of the error views supported by
Django."""
Django.
"""

from django.http import HttpResponse, HttpRequest

Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@


def load_requirements():
"""Return a list of package dependencies from the project requirements file"""

with open('requirements.txt') as f:
return f.read().splitlines()


def get_meta():
"""Return the package version and author as defined in the package __init__ file."""

init_path = Path(__file__).resolve().parent / 'django_easy_error/__init__.py'
with init_path.open('r') as infile:
init_content = infile.read()
Expand All @@ -23,10 +27,10 @@ def get_meta():
return version, author


version, author = get_meta()
_version, _author = get_meta()
setup(name='django-easy-error',
version=version,
author=author,
version=_version,
author=_author,
packages=find_packages(),
keywords='Django HTTP Error Pages',
description='Easy template integration for django error pages',
Expand Down

0 comments on commit fe6ac08

Please sign in to comment.