Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility tests #664

Merged
merged 8 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hazelcast/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "5.3.0"
__version__ = "5.4.0"

# Set the default handler to "hazelcast" loggers
# to avoid "No handlers could be found" warnings.
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/backward_compatible/predicate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
write_string_to_writer,
read_string_from_reader,
)
from tests.util import random_string, get_abs_path
from tests.util import random_string, get_abs_path, skip_if_server_version_newer_than_or_equal
from hazelcast import HazelcastClient


Expand Down Expand Up @@ -171,6 +171,8 @@ def test_false(self):
self.assertCountEqual(self.map.key_set(predicate), [])

def test_paging(self):
# https://github.com/hazelcast/hazelcast-python-client/issues/666
skip_if_server_version_newer_than_or_equal(self, self.client, "5.4")
self.fill_map_numeric()
predicate = paging(less("this", 4), 2)
self.assertCountEqual([0, 1], self.map.key_set(predicate))
Expand Down Expand Up @@ -339,6 +341,8 @@ def setUpClass(cls):
cls.map = cls.client.get_map(random_string()).blocking()

def setUp(self):
# https://github.com/hazelcast/hazelcast-python-client/issues/666
skip_if_server_version_newer_than_or_equal(self, self.client, "5.4")
self.map.clear()

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def on_cancel(self) -> None:
# Should be cancelled since on_message raised error
self.assertTrueEventually(lambda: self.assertEqual(0, len(topic._wrapped._runners)))

self.assertEqual(1, on_cancel_call_count.get())
if compare_client_version("5.4") >= 0:
self.assertEqual(1, on_cancel_call_count.get())

def test_add_listener_when_on_message_and_is_terminal_raises_error(self):
topic = self.get_topic(random_string())
Expand Down Expand Up @@ -319,7 +320,8 @@ def on_cancel(self) -> None:
# Should be cancelled since on_message raised error
self.assertTrueEventually(lambda: self.assertEqual(0, len(topic._wrapped._runners)))

self.assertEqual(1, on_cancel_call_count.get())
if compare_client_version("5.4") >= 0:
self.assertEqual(1, on_cancel_call_count.get())

def test_add_listener_with_non_callable(self):
topic = self.get_topic(random_string())
Expand Down Expand Up @@ -352,7 +354,8 @@ def on_cancel(self) -> None:

registration_id = topic.add_listener(Listener())
self.assertTrue(topic.remove_listener(registration_id))
self.assertEqual(1, on_cancel_call_count.get())
if compare_client_version("5.4") >= 0:
self.assertEqual(1, on_cancel_call_count.get())

def test_remove_listener_does_not_receive_messages_after_removal(self):
topic = self.get_topic(random_string())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
compare_server_version_with_rc,
skip_if_client_version_older_than,
skip_if_server_version_older_than,
skip_if_server_version_newer_than_or_equal,
)

try:
Expand Down Expand Up @@ -672,6 +673,8 @@ def test_entry_set_with_predicate(self):
)

def test_entry_set_with_paging_predicate(self):
# https://github.com/hazelcast/hazelcast-python-client/issues/666
skip_if_server_version_newer_than_or_equal(self, self.client, "5.4")
self._put_from_another_client(INNER_COMPACT_INSTANCE, OUTER_COMPACT_INSTANCE)
self.assertEqual(
[(INNER_COMPACT_INSTANCE, OUTER_COMPACT_INSTANCE)],
Expand Down Expand Up @@ -751,6 +754,8 @@ def test_key_set_with_predicate(self):
)

def test_key_set_with_paging_predicate(self):
# https://github.com/hazelcast/hazelcast-python-client/issues/666
skip_if_server_version_newer_than_or_equal(self, self.client, "5.4")
self._put_from_another_client(OUTER_COMPACT_INSTANCE, INNER_COMPACT_INSTANCE)
self.assertEqual(
[OUTER_COMPACT_INSTANCE],
Expand Down Expand Up @@ -882,6 +887,8 @@ def test_values_with_predicate(self):
self.assertEqual([OUTER_COMPACT_INSTANCE], self.map.values(CompactPredicate()))

def test_values_with_paging_predicate(self):
# https://github.com/hazelcast/hazelcast-python-client/issues/666
skip_if_server_version_newer_than_or_equal(self, self.client, "5.4")
self._put_from_another_client(INNER_COMPACT_INSTANCE, OUTER_COMPACT_INSTANCE)
self.assertEqual([OUTER_COMPACT_INSTANCE], self.map.values(paging(CompactPredicate(), 1)))

Expand Down
Loading