Skip to content

Commit 3741de3

Browse files
authored
Merge pull request #43 from taskbadger/sk/remove-deprecated-progress
Remove deprecated update_progress / increment_progress
2 parents 4dfd61e + 35753c1 commit 3741de3

2 files changed

Lines changed: 11 additions & 40 deletions

File tree

taskbadger/sdk.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,6 @@ def update_status(self, status: StatusEnum):
367367
"""Update the task status"""
368368
self.update(status=status)
369369

370-
def increment_progress(self, amount: int):
371-
warnings.warn(
372-
"'task.increment_progress' will be removed in v1.7.0. Use 'task.increment_value' instead.",
373-
DeprecationWarning,
374-
stacklevel=2,
375-
)
376-
self.increment_value(amount)
377-
378370
def increment_value(self, amount: int):
379371
"""Increment the task progress by adding the specified amount to the current value.
380372
If the task value is not set it will be set to `amount`.
@@ -384,14 +376,6 @@ def increment_value(self, amount: int):
384376
new_amount = value_norm + amount
385377
self.update(value=new_amount)
386378

387-
def update_progress(self, value: int, value_step: int = None, rate_limit: int = None):
388-
warnings.warn(
389-
"'task.update_progress' will be removed in v1.7.0. Use 'task.update_value' instead.",
390-
DeprecationWarning,
391-
stacklevel=2,
392-
)
393-
self.update_value(value, value_step, rate_limit)
394-
395379
def update_value(self, value: int, value_step: int = None, rate_limit: int = None) -> bool:
396380
"""Update task progress.
397381

tests/test_sdk.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_ping(settings, patched_update):
190190
assert len(patched_update.call_args_list) == 2
191191

192192

193-
def test_update_progress_rate_limit(settings, patched_update):
193+
def test_update_value_rate_limit(settings, patched_update):
194194
task = Task(task_for_test(value=1))
195195

196196
updated_at = task.updated
@@ -210,58 +210,45 @@ def test_update_progress_rate_limit(settings, patched_update):
210210
assert len(patched_update.call_args_list) == 2
211211

212212

213-
def test_update_progress_value_step(settings, patched_update):
213+
def test_update_value_value_step(settings, patched_update):
214214
task = Task(task_for_test(value=1))
215215

216216
patched_update.return_value = Response(HTTPStatus.OK, b"", {}, task_for_test(value=4))
217-
task.update_progress(4, value_step=5)
217+
task.update_value(4, value_step=5)
218218
assert len(patched_update.call_args_list) == 0
219219

220-
task.update_progress(4)
220+
task.update_value(4)
221221
_verify_update(settings, patched_update, value=4)
222222

223-
task.update_progress(8, value_step=5)
223+
task.update_value(8, value_step=5)
224224
assert len(patched_update.call_args_list) == 1
225225

226-
task.update_progress(9, value_step=5)
226+
task.update_value(9, value_step=5)
227227
assert len(patched_update.call_args_list) == 2
228228

229229

230-
def test_update_progress_min_interval_both(settings, patched_update):
230+
def test_update_value_min_interval_both(settings, patched_update):
231231
task = Task(task_for_test(value=1))
232232

233233
patched_update.return_value = Response(HTTPStatus.OK, b"", {}, task_for_test(value=4))
234234
# neither checks pass
235-
task.update_progress(4, rate_limit=1, value_step=5)
235+
task.update_value(4, rate_limit=1, value_step=5)
236236
assert len(patched_update.call_args_list) == 0
237237

238238
# value check passes
239-
task.update_progress(6, rate_limit=1, value_step=5)
239+
task.update_value(6, rate_limit=1, value_step=5)
240240
_verify_update(settings, patched_update, value=6)
241241

242242
# neither checks pass
243-
task.update_progress(8, rate_limit=1, value_step=5)
243+
task.update_value(8, rate_limit=1, value_step=5)
244244
assert len(patched_update.call_args_list) == 1
245245

246246
# time check passes
247247
task._task.updated = task._task.updated - datetime.timedelta(seconds=1)
248-
task.update_progress(6, rate_limit=1, value_step=5)
248+
task.update_value(6, rate_limit=1, value_step=5)
249249
assert len(patched_update.call_args_list) == 2
250250

251251

252-
def test_increment_progress(settings, patched_update):
253-
api_task = task_for_test()
254-
task = Task(api_task)
255-
256-
patched_update.return_value = Response(HTTPStatus.OK, b"", {}, task_for_test(value=10))
257-
258-
task.increment_progress(10)
259-
_verify_update(settings, patched_update, value=10)
260-
261-
task.increment_progress(10)
262-
_verify_update(settings, patched_update, value=20)
263-
264-
265252
def test_update_timeouts(settings, patched_update):
266253
api_task = task_for_test()
267254
task = Task(api_task)

0 commit comments

Comments
 (0)