From fa04968fa76017666b0702d2b261a2a5f335e3f1 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Mon, 1 Jul 2024 15:00:02 +0100 Subject: [PATCH 1/2] docs: replace pytz usage to zoneinfo in documentation --- CHANGES.rst | 1 + docs/usage.rst | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index e1c5d9f1..768fbe2c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,7 @@ Minor changes: - Make coverage report submission optional for pull requests - Rename ``master`` branch to ``main``, see `Issue `_ +- Update ``docs/usage.rst`` to use zoneinfo instead of pytz. - Added missing public classes and functions to API documentation. - Improved namespace management in the ``icalendar`` directory. - Add Python version badge and badge for test coverage diff --git a/docs/usage.rst b/docs/usage.rst index 35ea03b5..35502971 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -231,10 +231,10 @@ Property parameters are automatically added, depending on the input value. For example, for date/time related properties, the value type and timezone identifier (if applicable) are automatically added here:: - >>> import pytz + >>> import zoneinfo >>> event = Event() >>> event.add('dtstart', datetime(2010, 10, 10, 10, 0, 0, - ... tzinfo=pytz.timezone("Europe/Vienna"))) + ... tzinfo=zoneinfo.ZoneInfo("Europe/Vienna"))) >>> lines = event.to_ical().splitlines() >>> assert ( @@ -262,7 +262,7 @@ Init the calendar:: >>> cal = Calendar() >>> from datetime import datetime - >>> import pytz + >>> import zoneinfo Some properties are required to be compliant:: @@ -273,9 +273,9 @@ We need at least one subcomponent for a calendar to be compliant:: >>> event = Event() >>> event.add('summary', 'Python meeting about calendaring') - >>> event.add('dtstart', datetime(2005,4,4,8,0,0,tzinfo=pytz.utc)) - >>> event.add('dtend', datetime(2005,4,4,10,0,0,tzinfo=pytz.utc)) - >>> event.add('dtstamp', datetime(2005,4,4,0,10,0,tzinfo=pytz.utc)) + >>> event.add('dtstart', datetime(2005,4,4,8,0,0,tzinfo=zoneinfo.ZoneInfo("UTC"))) + >>> event.add('dtend', datetime(2005,4,4,10,0,0,tzinfo=zoneinfo.ZoneInfo("UTC"))) + >>> event.add('dtstamp', datetime(2005,4,4,0,10,0,tzinfo=zoneinfo.ZoneInfo("UTC"))) A property with parameters. Notice that they are an attribute on the value:: From 4e218edacd34d0568aa0a2ef0399348e907e2f38 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Mon, 1 Jul 2024 22:11:47 +0100 Subject: [PATCH 2/2] Make coverage report optional in case it fails to submit (#664) * Make coverage report optional in case it fails to submit Sometimes, we get this error: coveralls.exception.CoverallsException: Could not submit coverage: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs This PR allows the error to happen while also maintaining the test result and making sure that we actually installed all dependencies. This is a follow up from https://github.com/collective/icalendar/pull/644 main branch failed: https://github.com/collective/icalendar/actions/runs/9663149658/job/26654629821 * log changes * use github service for coverage * Finalize coverage even if tests failed --------- Co-authored-by: Steve Piercy --- .github/workflows/tests.yml | 7 +++++-- CHANGES.rst | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d8aa8c22..d96e5a87 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: - name: Test run: tox -e ${{ matrix.config[1] }} - name: Upload coverage data to coveralls.io - run: coveralls --service=github-actions + run: coveralls --service=github || which coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_REPO_TOKEN: ${{ secrets.CODECOV_TOKEN }} @@ -60,13 +60,16 @@ jobs: # see https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support name: Submit test coverage needs: run-tests + # always finalize coverage aftest tests ran + # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs + if: ${{ always() }} runs-on: ubuntu-latest container: python:3-slim steps: - name: Install dependencies run: pip3 install --upgrade coveralls - name: Upload coverage - run: coveralls --service=github-actions --finish + run: coveralls --service=github --finish || which coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_REPO_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/CHANGES.rst b/CHANGES.rst index e1c5d9f1..2bb15584 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,7 @@ Minor changes: - Test that all code works with both ``pytz`` and ``zoneinfo``. - Make coverage report submission optional for pull requests +- Parallelize coverage - Rename ``master`` branch to ``main``, see `Issue `_ - Added missing public classes and functions to API documentation.