From a0e3be0d0a137d5e6b40e0d427ae54887aea895c Mon Sep 17 00:00:00 2001 From: ndxmrb <162720426+ndxmrb@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:22:52 +0200 Subject: [PATCH] fix: Python 3.9 support (#209) * chore: ignore .vscode folder * fix: support PEP 604 annotation syntax in python 3.9 * tests: do not use datetime.UTC alias to support python 3.9 * style: linting * Revert "style: linting" This reverts commit 84c72140d3ad6a31a0c82c806d47ea6140e8e67d. * style: linting * ci: add 3.9 and 3.10 to test matrix --- .github/workflows/testing.yaml | 2 +- .gitignore | 1 + fastapi_azure_auth/exceptions.py | 2 ++ tests/test_user.py | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index ea51b5b6..7f711093 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12" ] fastapi-version: [ "0.103.2", "0.111.1"] steps: - name: Check out repository diff --git a/.gitignore b/.gitignore index 89e84fbf..697a452d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.pyc .idea/* +.vscode env/ demo_project/.env .DS_Store diff --git a/fastapi_azure_auth/exceptions.py b/fastapi_azure_auth/exceptions.py index 336cb953..8e778bfc 100644 --- a/fastapi_azure_auth/exceptions.py +++ b/fastapi_azure_auth/exceptions.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from fastapi import HTTPException, WebSocketException, status from starlette.requests import HTTPConnection diff --git a/tests/test_user.py b/tests/test_user.py index f91f040a..205555fb 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -85,7 +85,7 @@ def test_guest_user(claims: Dict[str, str], expected: bool): def get_utc_now_as_unix_timestamp() -> int: - date = datetime.datetime.now(datetime.UTC) + date = datetime.datetime.now(datetime.timezone.utc) return calendar.timegm(date.utctimetuple())