From 2afcbc43772bc56a0e891a61dca8609909c5de0a Mon Sep 17 00:00:00 2001 From: cureprotocols Date: Thu, 3 Apr 2025 19:28:25 -0600 Subject: [PATCH 1/3] Fix: Restore test collection for credentials and mock tests --- google/auth/external_account_authorized_user.py | 2 ++ tests/oauth2/test_credentials.py | 2 ++ tests/test_external_account_authorized_user.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/google/auth/external_account_authorized_user.py b/google/auth/external_account_authorized_user.py index 4d0c3c680..4e2601fc3 100644 --- a/google/auth/external_account_authorized_user.py +++ b/google/auth/external_account_authorized_user.py @@ -378,3 +378,5 @@ def from_file(cls, filename, **kwargs): with io.open(filename, "r", encoding="utf-8") as json_file: data = json.load(json_file) return cls.from_info(data, **kwargs) + + diff --git a/tests/oauth2/test_credentials.py b/tests/oauth2/test_credentials.py index 7d2a9b872..7c7715410 100644 --- a/tests/oauth2/test_credentials.py +++ b/tests/oauth2/test_credentials.py @@ -1066,3 +1066,5 @@ def test_before_request(self, refresh, apply): cred.before_request(mock.Mock(), "GET", "https://example.com", {}) refresh.assert_called() apply.assert_called() + + diff --git a/tests/test_external_account_authorized_user.py b/tests/test_external_account_authorized_user.py index 93926a131..81189863e 100644 --- a/tests/test_external_account_authorized_user.py +++ b/tests/test_external_account_authorized_user.py @@ -557,3 +557,5 @@ def test_from_file_full_options(self, tmpdir): assert creds.scopes == SCOPES assert creds._revoke_url == REVOKE_URL assert creds._quota_project_id == QUOTA_PROJECT_ID + + From 49c318cea8093bb99d08e657215d2eae5e60ee48 Mon Sep 17 00:00:00 2001 From: cureprotocols Date: Thu, 3 Apr 2025 19:42:29 -0600 Subject: [PATCH 2/3] Chore: Normalize line endings and prevent CRLF issues --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..d9bd16b09 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.py text eol=lf From 365f7a7b1d7c7ddb90896ab57e0f8f661c3ab09c Mon Sep 17 00:00:00 2001 From: cureprotocols Date: Fri, 4 Apr 2025 08:51:36 -0600 Subject: [PATCH 3/3] Add CI for Python matrix --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..4fb2923cb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Python CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.8, 3.9, 3.10, 3.11] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python $\{{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: $\{{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[tests] + + - name: Run tests + run: | + pytest -v tests/