Skip to content

Commit

Permalink
refactor: python coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
ajithpmohan committed Aug 31, 2020
1 parent 2bad52e commit e53ed53
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 88 deletions.
213 changes: 129 additions & 84 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,97 +1,142 @@
### Python ###
# Byte-compiled / optimized / DLL files
*/__pycache__/
*/*.py[cod]


# PyCharm
*/.idea/
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
*/.Python
*/.env
*/env/
*/envs/
*/build/
*/develop-eggs/
*/dist/
*/downloads/
*/eggs/
*/lib/
*/lib64/
*/parts/
*/sdist/
*/var/
*/*.egg-info/
*/.installed.cfg
*/*.egg
*/.*~
*/.swp

.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest

*.spec

# Installer logs
*/pip-log.txt


# DB
*/*.sql
*/*.sqlite3
*/tags

pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
*/htmlcov/
*/.tox/
*/coverage
*/.coverage
*/.cache
*/nosetests.xml
*/coverage.xml
*/tests/coverage_html/
*/tests/.coverage
*/tests/report/
*/.nyc_output
*/cypress/screenshots/


# Documentation
*/docs/_build/
*/docs/locale/


### Django ###
*/*.log
*/*.pot
*/*.pyc
*/__pycache__/
*/local.py


# Assets. If collect static was done locally with defaults, ignore collected files
*/static/
*/media/
*/mediafiles/
*/tmp/


# Visual Studio Code
*/.vscode/

# react.js dependencies
*/node_modules
*/.pnp
*/.pnp.js

# misc
*/.DS_Store

*/npm-debug.log*
*/yarn-debug.log*
*/yarn-error.log*
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*/coverage/*
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

*/.nyc_output/*
*/mediafiles/*
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Download the repository:
git clone [email protected]:ajithpmohan/taxi-app.git

## Permission Required
Before building the services update the file permission of `server/entrypoint.sh`
Before building the services update the file permission of `server/entrypoint.sh` & `server/coverage.sh`

chmod +x server/entrypoint.sh
chmod +x server/entrypoint.sh server/coverage.sh

## Build the Services

Expand All @@ -38,15 +38,19 @@ Before building the services update the file permission of `server/entrypoint.sh
## Swagger for Django (backend) Service
Access it through [http://0.0.0.0:8100/swagger/](http://0.0.0.0:8100/swagger/)

## React.js (frontend) Code Linter
## Run React.js Code Linter
docker-compose exec client npm run e2e

## Run React.js E2E Testing using Cypress
docker-compose -f cy-run.yml run e2e

## Python Code Linter
## Run Django Code Linter

Before code pushing, run [flake8](https://simpleisbetterthancomplex.com/packages/2016/08/05/flake8.html) for code styling and [isort](https://simpleisbetterthancomplex.com/packages/2016/10/08/isort.html) for organizing the python imports.

docker-compose exec server flake8
docker-compose exec server isort -rc .

## Create Django Coverage Report

docker-compose exec server ./coverage.sh
6 changes: 6 additions & 0 deletions server/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e # Configure shell so that if one command fails, it exits
coverage erase
coverage run manage.py test apps
coverage report
coverage html
10 changes: 10 additions & 0 deletions server/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[flake8]
exclude = .git, */migrations/*
max-line-length = 119

[coverage:run]
source = apps/
omit =
*/migrations/*
manage.py

[coverage:report]
show_missing = True
skip_covered = True

0 comments on commit e53ed53

Please sign in to comment.