Skip to content

Commit 13b44df

Browse files
partheatseaversushicw
authored
chore: release 2.3.1 (#319)
* ci: run lint / mypy / unit tests / coverage as GH actions (#287) Make GH Action checks required * fix: exclude function target from retry deadline exceeded exception message (#318) * Exclude function target from retry deadline exceeded exception message * apply similar patch in retry_async.py Co-authored-by: Anthonios Partheniou <[email protected]> * chore: release 2.3.1 * enable checks on release branch v2.3.1 Co-authored-by: Tres Seaver <[email protected]> Co-authored-by: Chris Wilson <[email protected]>
1 parent cb091f8 commit 13b44df

File tree

9 files changed

+187
-6
lines changed

9 files changed

+187
-6
lines changed

.github/sync-repo-settings.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
# https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings
2+
# Rules for main branch protection
3+
branchProtectionRules:
4+
# Identifies the protection rule pattern. Name of the branch to be protected.
5+
# Defaults to `main`
6+
- pattern: main
7+
requiresCodeOwnerReviews: true
8+
requiresStrictStatusChecks: true
9+
requiredStatusCheckContexts:
10+
- 'cla/google'
11+
# No Kokoro: the following are Github actions
12+
- 'lint-mypy'
13+
- 'unit-3.6'
14+
- 'unit-3.7'
15+
- 'unit-3.8'
16+
- 'unit-3.9'
17+
- 'unit-3.10'
18+
- 'unit_grpc_gcp-3.6'
19+
- 'unit_grpc_gcp-3.7'
20+
- 'unit_grpc_gcp-3.8'
21+
- 'unit_grpc_gcp-3.9'
22+
- 'unit_grpc_gcp-3.10'
23+
- 'unit_wo_grpc-3.6'
24+
- 'unit_wo_grpc-3.10'
25+
- 'cover'
26+
- pattern: v2.3.1
27+
requiresCodeOwnerReviews: true
28+
requiresStrictStatusChecks: true
29+
requiredStatusCheckContexts:
30+
- 'cla/google'
31+
# No Kokoro: the following are Github actions
32+
- 'lint-mypy'
33+
- 'unit-3.6'
34+
- 'unit-3.7'
35+
- 'unit-3.8'
36+
- 'unit-3.9'
37+
- 'unit-3.10'
38+
- 'unit_grpc_gcp-3.6'
39+
- 'unit_grpc_gcp-3.7'
40+
- 'unit_grpc_gcp-3.8'
41+
- 'unit_grpc_gcp-3.9'
42+
- 'unit_grpc_gcp-3.10'
43+
- 'unit_wo_grpc-3.6'
44+
- 'unit_wo_grpc-3.10'
45+
- 'cover'
146
permissionRules:
247
- team: actools-python
348
permission: admin

.github/workflows/unittest_lint.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: "Lint / Unit tests / Cover / Mypy"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- v2.3.1
8+
9+
10+
jobs:
11+
12+
run-lint-mypy:
13+
name: lint-mypy
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Setup Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: "3.10"
25+
26+
- name: Install nox
27+
run: |
28+
python -m pip install --upgrade setuptools pip wheel
29+
python -m pip install nox
30+
31+
- name: Run lint
32+
run: |
33+
nox -s lint
34+
35+
- name: Run lint_setup_py
36+
run: |
37+
nox -s lint_setup_py
38+
39+
- name: Run mypy
40+
run: |
41+
nox -s mypy
42+
43+
run-unittests:
44+
name: unit${{ matrix.option }}-${{ matrix.python }}
45+
runs-on: ubuntu-latest
46+
strategy:
47+
matrix:
48+
option: ["", "_grpc_gcp", "_wo_grpc"]
49+
python:
50+
- "3.6"
51+
- "3.7"
52+
- "3.8"
53+
- "3.9"
54+
- "3.10"
55+
exclude:
56+
- option: "_wo_grpc"
57+
python: 3.7
58+
- option: "_wo_grpc"
59+
python: 3.8
60+
- option: "_wo_grpc"
61+
python: 3.9
62+
63+
steps:
64+
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
68+
- name: Setup Python
69+
uses: actions/setup-python@v2
70+
with:
71+
python-version: ${{ matrix.python }}
72+
73+
- name: Install nox
74+
run: |
75+
python -m pip install --upgrade setuptools pip wheel
76+
python -m pip install nox
77+
78+
- name: Run unit tests
79+
env:
80+
COVERAGE_FILE: .coverage${{ matrix.option }}-${{matrix.python }}
81+
run: |
82+
nox -s unit${{ matrix.option }}-${{ matrix.python }}
83+
84+
- name: Upload coverage results
85+
uses: actions/upload-artifact@v2
86+
with:
87+
name: coverage-artifacts
88+
path: .coverage${{ matrix.option }}-${{ matrix.python }}
89+
90+
report-coverage:
91+
name: cover
92+
runs-on: ubuntu-latest
93+
needs:
94+
- run-unittests
95+
96+
steps:
97+
98+
- name: Checkout
99+
uses: actions/checkout@v2
100+
101+
- name: Setup Python
102+
uses: actions/setup-python@v2
103+
with:
104+
python-version: "3.10"
105+
106+
- name: Install coverage
107+
run: |
108+
python -m pip install --upgrade setuptools pip wheel
109+
python -m pip install coverage
110+
111+
- name: Download coverage results
112+
uses: actions/download-artifact@v2
113+
with:
114+
name: coverage-artifacts
115+
path: .coverage-results/
116+
117+
- name: Report coverage results
118+
run: |
119+
coverage combine .coverage-results/.coverage*
120+
coverage report --show-missing --fail-under=100

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
[1]: https://pypi.org/project/google-api-core/#history
66

7+
## [2.3.1](https://www.github.com/googleapis/python-api-core/compare/v2.3.0...v2.3.1) (2021-12-15)
8+
9+
10+
### Bug Fixes
11+
12+
* exclude function target from retry deadline exceeded exception message ([#318](https://www.github.com/googleapis/python-api-core/issues/318)) ([34ebdcc](https://www.github.com/googleapis/python-api-core/commit/34ebdcc251d4f3d7d496e8e0b78847645a06650b))
13+
14+
715
## [2.3.0](https://www.github.com/googleapis/python-api-core/compare/v2.2.2...v2.3.0) (2021-11-25)
816

917

google/api_core/retry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
203203
if deadline_datetime is not None:
204204
if deadline_datetime <= now:
205205
raise exceptions.RetryError(
206-
"Deadline of {:.1f}s exceeded while calling {}".format(
207-
deadline, target
206+
"Deadline of {:.1f}s exceeded while calling target function".format(
207+
deadline
208208
),
209209
last_exc,
210210
) from last_exc

google/api_core/retry_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ async def retry_target(target, predicate, sleep_generator, deadline, on_error=No
132132
# Chains the raising RetryError with the root cause error,
133133
# which helps observability and debugability.
134134
raise exceptions.RetryError(
135-
"Deadline of {:.1f}s exceeded while calling {}".format(
136-
deadline, target
135+
"Deadline of {:.1f}s exceeded while calling target function".format(
136+
deadline
137137
),
138138
last_exc,
139139
) from last_exc

google/api_core/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "2.3.0"
15+
__version__ = "2.3.1"

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def unit(session):
132132
default(session)
133133

134134

135-
@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
135+
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
136136
def unit_grpc_gcp(session):
137137
"""Run the unit test suite with grpcio-gcp installed."""
138138
constraints_path = str(

tests/asyncio/test_retry_async.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ async def test_retry_target_deadline_exceeded(utcnow, sleep):
120120
assert exc_info.match("last exception: meep")
121121
assert target.call_count == 2
122122

123+
# Ensure the exception message does not include the target fn:
124+
# it may be a partial with user data embedded
125+
assert str(target) not in exc_info.exconly()
126+
123127

124128
@pytest.mark.asyncio
125129
async def test_retry_target_bad_sleep_generator():

tests/unit/test_retry.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ def test_retry_target_deadline_exceeded(utcnow, sleep):
152152
assert exc_info.match("last exception: meep")
153153
assert target.call_count == 2
154154

155+
# Ensure the exception message does not include the target fn:
156+
# it may be a partial with user data embedded
157+
assert str(target) not in exc_info.exconly()
158+
155159

156160
def test_retry_target_bad_sleep_generator():
157161
with pytest.raises(ValueError, match="Sleep generator"):

0 commit comments

Comments
 (0)