From af6a979fc1637e859f9d38856ea8423bb5b4df71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Mon, 4 Mar 2024 10:19:26 +0100 Subject: [PATCH] SyncableDroppable.cleanup bugs out --- CHANGELOG.md | 4 +++- satella/__init__.py | 2 +- satella/coding/structures/syncable_droppable.py | 6 ++++-- tests/test_coding/test_syncable_droppable.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e96f8791..b8a8d96a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ # v2.24.1 -* minor pylint improvements \ No newline at end of file +* minor pylint improvements +* better coverage +* SyncableDroppable.cleanup() bugs out, wrote a quick patch for it to do nothing and filed as #61. diff --git a/satella/__init__.py b/satella/__init__.py index 1f0e6ffa..49bfef55 100644 --- a/satella/__init__.py +++ b/satella/__init__.py @@ -1 +1 @@ -__version__ = '2.24.1a2' +__version__ = '2.24.1a4' diff --git a/satella/coding/structures/syncable_droppable.py b/satella/coding/structures/syncable_droppable.py index fc02064f..a1f4c0a4 100644 --- a/satella/coding/structures/syncable_droppable.py +++ b/satella/coding/structures/syncable_droppable.py @@ -2,6 +2,7 @@ import bisect import itertools import math import typing as tp +import warnings from abc import ABCMeta, abstractmethod from satella.coding.concurrent.monitor import RMonitor @@ -163,9 +164,10 @@ class SyncableDroppable(RMonitor, tp.Generic[K, V]): and span_to_keep_in_memory. This may block for a while. + + .. warning:: This bugs out for now. For now, a UserWarning will be raised and nothing will be done. """ - self.cleanup_keep_in_db() - self.cleanup_keep_in_memory() + warnings.warn('Nothing done', UserWarning) def _cleanup_the_db(self) -> bool: """ diff --git a/tests/test_coding/test_syncable_droppable.py b/tests/test_coding/test_syncable_droppable.py index d319f1d8..fc6a6ff3 100644 --- a/tests/test_coding/test_syncable_droppable.py +++ b/tests/test_coding/test_syncable_droppable.py @@ -77,7 +77,7 @@ class TestSyncableDroppable(unittest.TestCase): sd.cleanup_keep_in_db() self.assertEqual(sd.start_entry, 200) self.assertEqual(db.data, []) - + self.assertWarns(UserWarning, lambda: sd.cleanup()) sd.cleanup_keep_in_memory() self.assertEqual(db.data, [(200, 5), (220, 5)]) synces = list(sd.on_sync_request()) -- GitLab