From 40bada73bd015b4d1a67d240a10e6ca128f7aa20 Mon Sep 17 00:00:00 2001 From: rhatgadkar-goog Date: Wed, 8 Jan 2025 09:38:54 -0800 Subject: [PATCH] chore: Add psycopg 2.9.10 into requirements-test.txt (#407) psycopg 2.9.10 is supported on Python 3.13 for Windows now: psycopg/psycopg2#1736. So we can add psycopg 2.9.10 into requirements-test.txt. This change does the following: - Add psycopg2 into requirement-tests.txt. - Fix the lint issue about enum member annotation: https://mypy.readthedocs.io/en/stable/changelog.html#change-to-enum-membership-semantics. - Move test_psycopg2_direct_connection.py back into tests/system folder because it can now run since psycopg2 is in requirements-test.txt. --- google/cloud/alloydb/connector/enums.py | 10 +++++----- requirements-test.txt | 9 +++++++++ .../system}/test_psycopg2_direct_connection.py | 0 3 files changed, 14 insertions(+), 5 deletions(-) rename {docs/samples => tests/system}/test_psycopg2_direct_connection.py (100%) diff --git a/google/cloud/alloydb/connector/enums.py b/google/cloud/alloydb/connector/enums.py index eab5a63a..b1b2086b 100644 --- a/google/cloud/alloydb/connector/enums.py +++ b/google/cloud/alloydb/connector/enums.py @@ -22,9 +22,9 @@ class IPTypes(Enum): Enum for specifying IP type to connect to AlloyDB with. """ - PUBLIC: str = "PUBLIC" - PRIVATE: str = "PRIVATE" - PSC: str = "PSC" + PUBLIC = "PUBLIC" + PRIVATE = "PRIVATE" + PSC = "PSC" @classmethod def _missing_(cls, value: object) -> None: @@ -39,8 +39,8 @@ class RefreshStrategy(Enum): Enum for specifying refresh strategy to connect to AlloyDB with. """ - LAZY: str = "LAZY" - BACKGROUND: str = "BACKGROUND" + LAZY = "LAZY" + BACKGROUND = "BACKGROUND" @classmethod def _missing_(cls, value: object) -> None: diff --git a/requirements-test.txt b/requirements-test.txt index d0c14928..605dd99b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,15 @@ asyncpg==0.30.0 mock==5.1.0 pg8000==1.31.2 + +# psycopg 2.9.10 isn't supported on Python 3.9 for macos-latest GitHub runner. +# It is supported for macos-12 runner: +# https://github.com/psycopg/psycopg2/issues/1737. But macos-12 runner is +# deprecated: https://github.com/actions/runner-images/issues/10721. So we +# install psycopg 2.9.9 on Python 3.9 for macos-latest runner. +psycopg2-binary==2.9.9; python_version == "3.9" and sys_platform == "darwin" +psycopg2-binary==2.9.10; python_version != "3.9" or sys_platform != "darwin" + pytest==8.3.4 pytest-asyncio==0.24.0 pytest-cov==6.0.0 diff --git a/docs/samples/test_psycopg2_direct_connection.py b/tests/system/test_psycopg2_direct_connection.py similarity index 100% rename from docs/samples/test_psycopg2_direct_connection.py rename to tests/system/test_psycopg2_direct_connection.py