From 6ddb0e4c8568bccc0345785755a827c5fbde03df Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Thu, 22 Aug 2024 14:20:24 +0300 Subject: [PATCH 1/6] Added ".vscode" to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5d78f439..81f3b75d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ Documentation/ .project .pydevproject .idea/ +.vscode/ .coverage celery/tests/cover/ .ve* From 5f7f98f6db32c92254b6ce964eb6dd334abdc36a Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Thu, 22 Aug 2024 14:24:46 +0300 Subject: [PATCH 2/6] Added a new step to generate code coverage report --- .github/workflows/test.yml | 6 ++++++ tox.ini | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 234cb667..36883aae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,3 +48,9 @@ jobs: run: tox env: DJANGO: ${{ matrix.django-version }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true # optional (default = false) + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true # optional (default = false) diff --git a/tox.ini b/tox.ini index 0b2e7380..1c406800 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,7 @@ sitepackages = False recreate = False commands = pip list - pytest -xv + pytest -xv --cov=django_celery_beat --cov-report=xml --no-cov-on-fail [testenv:apicheck] From d1442c84a3ec64e83bc82a6f81cb03c58cc1657c Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Thu, 22 Aug 2024 14:42:49 +0300 Subject: [PATCH 3/6] Added --cov-report term {posargs} --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1c406800..751809da 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,7 @@ sitepackages = False recreate = False commands = pip list - pytest -xv --cov=django_celery_beat --cov-report=xml --no-cov-on-fail + pytest -xv --cov=django_celery_beat --cov-report=xml --no-cov-on-fail --cov-report term {posargs} [testenv:apicheck] From dfb491d34ac2d997380c5a5a803d31a8fa279184 Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Thu, 22 Aug 2024 15:03:12 +0300 Subject: [PATCH 4/6] Skipping pypy for code coverage --- .github/workflows/test.yml | 8 +++++++- tox.ini | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 36883aae..069ec0ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,10 +45,16 @@ jobs: python -m pip install --upgrade pip python -m pip install tox tox-gh-actions - name: Test with tox - run: tox + run: | + if [ "${{ matrix.python-version }}" != "pypy-3.10" ]; then + tox -- --cov=django_celery_beat --cov-report=xml --no-cov-on-fail --cov-report term + else + tox + fi env: DJANGO: ${{ matrix.django-version }} - name: Upload coverage reports to Codecov + if: ${{ matrix.python-version != 'pypy-3.10' }} uses: codecov/codecov-action@v4 with: fail_ci_if_error: true # optional (default = false) diff --git a/tox.ini b/tox.ini index 751809da..75b5ef6f 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,7 @@ sitepackages = False recreate = False commands = pip list - pytest -xv --cov=django_celery_beat --cov-report=xml --no-cov-on-fail --cov-report term {posargs} + pytest -xv {posargs} [testenv:apicheck] From 193f747d739b1329d86594237532938f9fe5a976 Mon Sep 17 00:00:00 2001 From: Tomer Nosrati Date: Thu, 22 Aug 2024 15:13:00 +0300 Subject: [PATCH 5/6] Added code coverage config to pyproject.toml --- pyproject.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b6729577..1ef95b06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -127,3 +127,25 @@ lint.pylint.allow-magic-value-types = [ "str", ] lint.pylint.max-args = 8 # Default: 5 + +[tool.coverage.run] +branch = true +cover_pylib = false +include = ["*django_celery_beat/*"] +omit = ["django_celery_beat.tests.*"] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "if TYPE_CHECKING:", + "except ImportError:" +] +omit = [ + "*/python?.?/*", + "*/site-packages/*", + "*/pypy/*", + "*/.tox/*", + "*/docker/*", + "*/docs/*", + "*/test_*.py" +] From 2097b2f058b8433bdc150afd459ecf74196e9200 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:13:25 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1ef95b06..6e4f9b69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -131,21 +131,21 @@ lint.pylint.max-args = 8 # Default: 5 [tool.coverage.run] branch = true cover_pylib = false -include = ["*django_celery_beat/*"] -omit = ["django_celery_beat.tests.*"] +include = [ "*django_celery_beat/*" ] +omit = [ "django_celery_beat.tests.*" ] [tool.coverage.report] exclude_lines = [ - "pragma: no cover", - "if TYPE_CHECKING:", - "except ImportError:" + "pragma: no cover", + "if TYPE_CHECKING:", + "except ImportError:", ] omit = [ - "*/python?.?/*", - "*/site-packages/*", - "*/pypy/*", - "*/.tox/*", - "*/docker/*", - "*/docs/*", - "*/test_*.py" + "*/python?.?/*", + "*/site-packages/*", + "*/pypy/*", + "*/.tox/*", + "*/docker/*", + "*/docs/*", + "*/test_*.py", ]