Skip to content

Commit 68d7400

Browse files
author
Takashi Matsuo
authored
chore: remove gcp-devrel-py-tools from iam and datastore (GoogleCloudPlatform#3469)
* [datastore] chore: remove gcp-devrel-py-tools * [iam] chore: remove unused dependency
1 parent 75522dc commit 68d7400

4 files changed

Lines changed: 34 additions & 34 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1+
backoff==1.10.0
12
pytest==5.3.2
2-
gcp-devrel-py-tools==0.0.15
33
flaky==3.6.1

datastore/cloud-client/snippets_test.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
import os
1515

16-
from gcp_devrel.testing import eventually_consistent
17-
from flaky import flaky
16+
import backoff
1817
from google.cloud import datastore
1918
import pytest
2019

@@ -43,7 +42,7 @@ def client():
4342
client.cleanup()
4443

4544

46-
@flaky
45+
@pytest.mark.flaky
4746
class TestDatastoreSnippets:
4847
# These tests mostly just test the absence of exceptions.
4948
def test_incomplete_key(self, client):
@@ -106,19 +105,19 @@ def test_batch_lookup(self, client):
106105
def test_batch_delete(self, client):
107106
snippets.batch_delete(client)
108107

109-
@eventually_consistent.mark
108+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
110109
def test_unindexed_property_query(self, client):
111110
tasks = snippets.unindexed_property_query(client)
112111
client.entities_to_delete.extend(tasks)
113112
assert tasks
114113

115-
@eventually_consistent.mark
114+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
116115
def test_basic_query(self, client):
117116
tasks = snippets.basic_query(client)
118117
client.entities_to_delete.extend(tasks)
119118
assert tasks
120119

121-
@eventually_consistent.mark
120+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
122121
def test_projection_query(self, client):
123122
priorities, percents = snippets.projection_query(client)
124123
client.entities_to_delete.extend(
@@ -139,59 +138,60 @@ def test_cursor_paging(self, client):
139138
client.entities_to_delete.append(
140139
snippets.insert(client))
141140

142-
@eventually_consistent.call
143-
def _():
141+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
142+
def run_sample():
144143
results = snippets.cursor_paging(client)
145144
page_one, cursor_one, page_two, cursor_two = results
146145

147146
assert len(page_one) == 5
148147
assert len(page_two)
149148
assert cursor_one
149+
run_sample()
150150

151-
@eventually_consistent.mark
151+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
152152
def test_property_filter(self, client):
153153
tasks = snippets.property_filter(client)
154154
client.entities_to_delete.extend(tasks)
155155
assert tasks
156156

157-
@eventually_consistent.mark
157+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
158158
def test_composite_filter(self, client):
159159
tasks = snippets.composite_filter(client)
160160
client.entities_to_delete.extend(tasks)
161161
assert tasks
162162

163-
@eventually_consistent.mark
163+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
164164
def test_key_filter(self, client):
165165
tasks = snippets.key_filter(client)
166166
client.entities_to_delete.extend(tasks)
167167
assert tasks
168168

169-
@eventually_consistent.mark
169+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
170170
def test_ascending_sort(self, client):
171171
tasks = snippets.ascending_sort(client)
172172
client.entities_to_delete.extend(tasks)
173173
assert tasks
174174

175-
@eventually_consistent.mark
175+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
176176
def test_descending_sort(self, client):
177177
tasks = snippets.descending_sort(client)
178178
client.entities_to_delete.extend(tasks)
179179
assert tasks
180180

181-
@eventually_consistent.mark
181+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
182182
def test_multi_sort(self, client):
183183
tasks = snippets.multi_sort(client)
184184
client.entities_to_delete.extend(tasks)
185185
assert tasks
186186

187-
@eventually_consistent.mark
187+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
188188
def test_keys_only_query(self, client):
189189
keys = snippets.keys_only_query(client)
190190
client.entities_to_delete.extend(
191191
client.query(kind='Task').fetch())
192192
assert keys
193193

194-
@eventually_consistent.mark
194+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
195195
def test_distinct_on_query(self, client):
196196
tasks = snippets.distinct_on_query(client)
197197
client.entities_to_delete.extend(tasks)
@@ -246,37 +246,37 @@ def transactional_single_entity_group_read_only(self, client):
246246
assert task_list
247247
assert tasks_in_list
248248

249-
@eventually_consistent.mark
249+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
250250
def test_namespace_run_query(self, client):
251251
all_namespaces, filtered_namespaces = snippets.namespace_run_query(
252252
client)
253253
assert all_namespaces
254254
assert filtered_namespaces
255255
assert 'google' in filtered_namespaces
256256

257-
@eventually_consistent.mark
257+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
258258
def test_kind_run_query(self, client):
259259
kinds = snippets.kind_run_query(client)
260260
client.entities_to_delete.extend(
261261
client.query(kind='Task').fetch())
262262
assert kinds
263263
assert 'Task' in kinds
264264

265-
@eventually_consistent.mark
265+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
266266
def test_property_run_query(self, client):
267267
kinds = snippets.property_run_query(client)
268268
client.entities_to_delete.extend(
269269
client.query(kind='Task').fetch())
270270
assert kinds
271271
assert 'Task' in kinds
272272

273-
@eventually_consistent.mark
273+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
274274
def test_property_by_kind_run_query(self, client):
275275
reprs = snippets.property_by_kind_run_query(client)
276276
client.entities_to_delete.extend(
277277
client.query(kind='Task').fetch())
278278
assert reprs
279279

280-
@eventually_consistent.mark
280+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
281281
def test_index_merge_queries(self, client):
282282
snippets.index_merge_queries(client)

datastore/cloud-client/tasks_test.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
import os
1515

16-
from gcp_devrel.testing import eventually_consistent
17-
from flaky import flaky
16+
import backoff
1817
from google.cloud import datastore
1918
import pytest
2019

@@ -35,20 +34,20 @@ def client():
3534
[x.key for x in client.query(kind='Task').fetch()])
3635

3736

38-
@flaky
37+
@pytest.mark.flaky
3938
def test_create_client():
4039
tasks.create_client(PROJECT)
4140

4241

43-
@flaky
42+
@pytest.mark.flaky
4443
def test_add_task(client):
4544
task_key = tasks.add_task(client, 'Test task')
4645
task = client.get(task_key)
4746
assert task
4847
assert task['description'] == 'Test task'
4948

5049

51-
@flaky
50+
@pytest.mark.flaky
5251
def test_mark_done(client):
5352
task_key = tasks.add_task(client, 'Test task')
5453
tasks.mark_done(client, task_key.id)
@@ -57,35 +56,37 @@ def test_mark_done(client):
5756
assert task['done']
5857

5958

60-
@flaky
59+
@pytest.mark.flaky
6160
def test_list_tasks(client):
6261
task1_key = tasks.add_task(client, 'Test task 1')
6362
task2_key = tasks.add_task(client, 'Test task 2')
6463

65-
@eventually_consistent.call
64+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
6665
def _():
6766
task_list = tasks.list_tasks(client)
6867
assert [x.key for x in task_list] == [task1_key, task2_key]
6968

7069

71-
@flaky
70+
@pytest.mark.flaky
7271
def test_delete_task(client):
7372
task_key = tasks.add_task(client, 'Test task 1')
7473
tasks.delete_task(client, task_key.id)
7574
assert client.get(task_key) is None
7675

7776

78-
@flaky
77+
@pytest.mark.flaky
7978
def test_format_tasks(client):
8079
task1_key = tasks.add_task(client, 'Test task 1')
8180
tasks.add_task(client, 'Test task 2')
8281
tasks.mark_done(client, task1_key.id)
8382

84-
@eventually_consistent.call
85-
def _():
83+
@backoff.on_exception(backoff.expo, AssertionError, max_time=120)
84+
def run_sample():
8685
output = tasks.format_tasks(tasks.list_tasks(client))
8786

8887
assert 'Test task 1' in output
8988
assert 'Test task 2' in output
9089
assert 'done' in output
9190
assert 'created' in output
91+
92+
run_sample()
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
pytest==5.3.2
2-
gcp-devrel-py-tools==0.0.15
32
retrying==1.3.3

0 commit comments

Comments
 (0)