Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/coverage #141

Merged
merged 8 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ examples/.ipynb_checkpoints/
runs/
.coverage
htmlcov
coverage.xml
.darts
docs_env
.DS_Store
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ Before working on a contribution (a new feature or a fix) make sure you can't fi
3. Clone the forked repository locally.
4. Create a clean python env and install requirements with pip: `pip install -r requirements/main.txt -r requirements/dev.txt -r requirements/release.txt`
5. Create a new branch with your fix / feature from the **develop** branch.
6. Create a pull request from your new branch to the **develop** branch.
6. Check that your code pass the tests / design new unit tests: `python -m unittest`.
7. Verify your tests coverage with `./coverage.sh` (additionaly you can generate xml report and use VSCode Coverage gutter to identify untested lines with `./coverage.sh xml`).
8. Create a pull request from your new branch to the **develop** branch.

## Contact Us

Expand Down
19 changes: 19 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# run and display coverage report properly filtered in terminal, xml or html
# usage: ./coverage.sh [ xml | html ]
usage()
{
echo "usage: ./coverage.sh [ xml | html ]"
}

#### Main
coverage run --source=. -m unittest
if [ -z "$1" ]; then
coverage report -m --fail-under=80 --omit='darts/tests*,*__init__.py'
else
case $1 in
xml ) coverage xml --fail-under=80 --omit='darts/tests*,*__init__.py' ;;
html ) coverage html --fail-under=80 --omit='darts/tests*,*__init__.py' ;;
* ) usage; exit 1;;
esac
fi