From b8d8b9bab60ee7d1ba4ca104750a980986ab13c9 Mon Sep 17 00:00:00 2001 From: Guillaume Raille Date: Mon, 13 Jul 2020 14:15:05 +0200 Subject: [PATCH 1/6] add coverage.sh --- coverage.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 coverage.sh diff --git a/coverage.sh b/coverage.sh new file mode 100644 index 0000000000..b61f2b0351 --- /dev/null +++ b/coverage.sh @@ -0,0 +1,3 @@ +# run and display coverage report properly filtered +coverage run --source=. -m unittest +coverage report -m --fail-under=80 --omit='darts/tests*,*__init__.py' \ No newline at end of file From 1116182345dfd72968c4b7b0bfbd8d04ae7d0cdb Mon Sep 17 00:00:00 2001 From: Guillaume Raille Date: Mon, 13 Jul 2020 14:15:41 +0200 Subject: [PATCH 2/6] fix permission on coverage.sh --- coverage.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 coverage.sh diff --git a/coverage.sh b/coverage.sh old mode 100644 new mode 100755 From 4f4888f6408d4701582a0d8fc4e7de232399f2bf Mon Sep 17 00:00:00 2001 From: Guillaume Raille Date: Mon, 13 Jul 2020 14:45:54 +0200 Subject: [PATCH 3/6] improve coverage sh script --- coverage.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/coverage.sh b/coverage.sh index b61f2b0351..23933ea0db 100755 --- a/coverage.sh +++ b/coverage.sh @@ -1,3 +1,18 @@ -# run and display coverage report properly filtered +#!/bin/bash +# run and display coverage report properly filtered in terminal, xml or html +usage() +{ + echo "usage: ./coverage.sh [ xml | html ]" +} + +#### Main coverage run --source=. -m unittest -coverage report -m --fail-under=80 --omit='darts/tests*,*__init__.py' \ No newline at end of file +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 From 1f4e0dea7ac3805d2da15bf16bac8e4e8e40e478 Mon Sep 17 00:00:00 2001 From: Guillaume Raille Date: Mon, 13 Jul 2020 14:47:22 +0200 Subject: [PATCH 4/6] add coverage.xml to .igtignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 969c5e0931..80300f11b6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ examples/.ipynb_checkpoints/ runs/ .coverage htmlcov +coverage.xml .darts docs_env .DS_Store From 7d5c9b34c8d67500c1176b00860988a619285745 Mon Sep 17 00:00:00 2001 From: Guillaume Raille Date: Mon, 13 Jul 2020 14:48:19 +0200 Subject: [PATCH 5/6] improve doc on coverage.sh --- coverage.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/coverage.sh b/coverage.sh index 23933ea0db..47cb4515fa 100755 --- a/coverage.sh +++ b/coverage.sh @@ -1,5 +1,6 @@ #!/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 ]" From 3a28e63bdac9db96a5472f3942fad819168c4093 Mon Sep 17 00:00:00 2001 From: Guillaume Raille Date: Tue, 14 Jul 2020 08:51:33 +0200 Subject: [PATCH 6/6] add doc for ./coverage.sh in contributing guide --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30caf006a0..31824a6864 100644 --- a/README.md +++ b/README.md @@ -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