Skip to content

Commit 8359f85

Browse files
feat: add support for python 3.10 (#227)
1 parent 9a0c78b commit 8359f85

File tree

9 files changed

+94
-7
lines changed

9 files changed

+94
-7
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Get secrets for tests.
18+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/cloud-sql/python-connector"
19+
20+
# Download trampoline resources.
21+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
22+
23+
# Use the trampoline script to run in docker.
24+
build_file: "cloud-sql-python-connector/.kokoro/trampoline.sh"
25+
26+
env_vars: {
27+
key: "TRAMPOLINE_IMAGE"
28+
value: "python:3.10-buster"
29+
}
30+
31+
# Tell the trampoline which tests to run.
32+
env_vars: {
33+
key: "TRAMPOLINE_BUILD_FILE"
34+
value: "github/cloud-sql-python-connector/.kokoro/tests/run_tests.sh"
35+
}
36+
37+
# Specify which tests to run
38+
env_vars: {
39+
key: "RUN_TESTS_SESSION"
40+
value: "test-3.10"
41+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto

google/cloud/sql/connector/instance_connection_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def __init__(
258258

259259
async def _set_instance_data() -> None:
260260
logger.debug("Updating instance data")
261-
self._refresh_in_progress = asyncio.locks.Event(loop=self._loop)
261+
self._refresh_in_progress = asyncio.locks.Event()
262262
self._current = self._loop.create_task(self._get_instance_data())
263263
self._next = self._loop.create_task(self._schedule_refresh())
264264

google/cloud/sql/connector/rate_limiter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(
4646
self.rate = rate
4747
self.max_capacity = max_capacity
4848
self._loop = loop or asyncio.get_event_loop()
49-
self._lock = asyncio.Lock(loop=self._loop)
49+
self._lock = asyncio.Lock()
5050
self._tokens: float = max_capacity
5151
self._last_token_update = self._loop.time()
5252

@@ -70,7 +70,7 @@ async def _wait_for_next_token(self) -> None:
7070
token_deficit = 1 - self._tokens
7171
if token_deficit > 0:
7272
wait_time = token_deficit / self.rate
73-
await asyncio.sleep(wait_time, loop=self._loop)
73+
await asyncio.sleep(wait_time)
7474

7575
async def acquire(self) -> None:
7676
"""

noxfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ def default(session, path):
8181
)
8282

8383

84-
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
84+
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
8585
def unit(session):
8686
default(session, os.path.join("tests", "unit"))
8787

8888

89-
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
89+
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
9090
def system(session):
9191
default(session, os.path.join("tests", "system"))
9292

9393

94-
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
94+
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
9595
def test(session):
9696
default(session, os.path.join("tests", "unit"))
9797
default(session, os.path.join("tests", "system"))

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"Programming Language :: Python :: 3.7",
7272
"Programming Language :: Python :: 3.8",
7373
"Programming Language :: Python :: 3.9",
74+
"Programming Language :: Python :: 3.10",
7475
],
7576
platforms="Posix; MacOS X; Windows",
7677
packages=packages,

tests/unit/test_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_connect_timeout(
3232

3333
async def timeout_stub(*args: Any, **kwargs: Any) -> None:
3434
try:
35-
await asyncio.sleep(timeout + 10, loop=async_loop)
35+
await asyncio.sleep(timeout + 10)
3636
except asyncio.CancelledError:
3737
return None
3838

0 commit comments

Comments
 (0)