From 320086cabb562b43292cb4f3f0badd3b3973ad74 Mon Sep 17 00:00:00 2001 From: Sagi Shadur Date: Sun, 7 Jun 2020 23:24:05 +0300 Subject: [PATCH 1/6] Fix tox warning about missing PYTHONPATH --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 8f0d5be60..bf2e11d78 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ envlist = flake8,towncrier-check,docs,package,py{35,36,37,38},pypy3 skip_missing_interpreters = true [testenv] +setenv = PYTHONPATH = {toxinidir}/src deps = pytest pytest-tldr From d17bc9cb9513446fba7a9d285e928eeafbcde693 Mon Sep 17 00:00:00 2001 From: Sagi Shadur Date: Sun, 7 Jun 2020 23:39:17 +0300 Subject: [PATCH 2/6] Add coverage to pytest --- .coveragerc | 9 +++++++++ tox.ini | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..a8765ba42 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,9 @@ +[run] +source = src/briefcase +omit = + src/**/__init__.py + src/briefcase/__main__.py + +[report] +show_missing = True +fail_under = 90 \ No newline at end of file diff --git a/tox.ini b/tox.ini index bf2e11d78..d6a018dc6 100644 --- a/tox.ini +++ b/tox.ini @@ -12,8 +12,9 @@ setenv = PYTHONPATH = {toxinidir}/src deps = pytest pytest-tldr + pytest-cov commands = - pytest -vv + pytest --cov -vv [testenv:flake8] skip_install = True From 97d89299ab10b1db1a10b8127f517503d7c5206f Mon Sep 17 00:00:00 2001 From: Sagi Shadur Date: Mon, 8 Jun 2020 00:02:38 +0300 Subject: [PATCH 3/6] Add change note --- changes/417.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/417.feature.rst diff --git a/changes/417.feature.rst b/changes/417.feature.rst new file mode 100644 index 000000000..400df3109 --- /dev/null +++ b/changes/417.feature.rst @@ -0,0 +1 @@ +Added pytest coverage to CI/CD process. \ No newline at end of file From 54836d368be1b8f455e7d363351d3cefdece6028 Mon Sep 17 00:00:00 2001 From: Sagi Shadur Date: Mon, 8 Jun 2020 00:04:23 +0300 Subject: [PATCH 4/6] include .coveragerc in MANIFEST.in --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 406fa9bb1..a0fa59728 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,6 +9,7 @@ include docs/spelling_wordlist include tests/integrations/xcode/simctl/README include pyproject.toml include tox.ini +include .coveragerc recursive-include changes *.rst recursive-include src *.py recursive-include docs *.bat From 07f3bc87a2e4f45b08c9f2006ccd7865556d09a3 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 16 Jun 2020 17:14:30 +0800 Subject: [PATCH 5/6] Add codecov.io to CI configuration. --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86b0a7b8a..b6c982914 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,13 @@ jobs: - name: Test run: | tox -e py + - name: Check coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unittests + fail_ci_if_error: true python-versions: # Only run this and subsequent steps on branches. From b79cf8c6ba0f7031159fd31b515ff2b9ad3d44ef Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 16 Jun 2020 17:23:26 +0800 Subject: [PATCH 6/6] Ensure coverage.xml is generated. --- .coveragerc | 1 - .gitignore | 1 + tox.ini | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index a8765ba42..065d81d7c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,4 +6,3 @@ omit = [report] show_missing = True -fail_under = 90 \ No newline at end of file diff --git a/.gitignore b/.gitignore index cd48fcc21..c827849f7 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ distribute-* .python-version .pytest_cache .coverage +coverage.xml venv/ .vscode/ .eggs/ diff --git a/tox.ini b/tox.ini index d6a018dc6..387b2d60c 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ deps = pytest-cov commands = pytest --cov -vv + coverage xml [testenv:flake8] skip_install = True