Skip to content

Commit 22571af

Browse files
committed
Fixed eventlet tests
1 parent 08ba052 commit 22571af

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

tests/unit/io/test_eventletreactor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@
2828
except ImportError:
2929
EventletConnection = None # noqa
3030

31+
skip_condition = EventletConnection is None or MONKEY_PATCH_LOOP != "eventlet"
3132
# There are some issues with some versions of pypy and eventlet
3233
@notpypy
33-
@unittest.skipIf(EventletConnection is None, "Skpping the eventlet tests because it's not installed")
34+
@unittest.skipIf(skip_condition, "Skipping the eventlet tests because it's not installed")
3435
@notmonkeypatch
3536
class EventletTimerTest(unittest.TestCase, TimerConnectionTests):
3637
@classmethod
3738
def setUpClass(cls):
3839
# This is run even though the class is skipped, so we need
3940
# to make sure no monkey patching is happening
40-
if not MONKEY_PATCH_LOOP:
41+
if skip_condition:
4142
return
4243

4344
# This is being added temporarily due to a bug in eventlet:

tests/unit/io/test_geventreactor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
GeventConnection = None # noqa
2828

2929

30-
@unittest.skipIf(GeventConnection is None, "Skpping the gevent tests because it's not installed")
30+
skip_condition = GeventConnection is None or MONKEY_PATCH_LOOP != "gevent"
31+
@unittest.skipIf(skip_condition, "Skipping the gevent tests because it's not installed")
3132
@notmonkeypatch
3233
class GeventTimerTest(unittest.TestCase, TimerConnectionTests):
3334
@classmethod
3435
def setUpClass(cls):
3536
# This is run even though the class is skipped, so we need
3637
# to make sure no monkey patching is happening
37-
if not MONKEY_PATCH_LOOP:
38+
if skip_condition:
3839
return
3940
gevent.monkey.patch_all()
4041
cls.connection_class = GeventConnection

tests/unit/test_cluster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,11 @@ def test_warning_on_no_lbp_with_contact_points(self):
377377
@test_category configuration
378378
"""
379379
with patch('cassandra.cluster.log') as patched_logger:
380-
Cluster(contact_points=['1'])
380+
Cluster(contact_points=['127.0.0.1'])
381381
patched_logger.warn.assert_called_once()
382382
warning_message = patched_logger.warn.call_args[0][0]
383383
self.assertIn('no load_balancing_policy', warning_message)
384-
self.assertIn("contact_points = ['1']", warning_message)
384+
self.assertIn("contact_points = ['127.0.0.1']", warning_message)
385385
self.assertIn('lbp = None', warning_message)
386386

387387
@mock_session_pools
@@ -397,5 +397,5 @@ def test_no_warning_on_contact_points_with_lbp(self):
397397
@test_category configuration
398398
"""
399399
with patch('cassandra.cluster.log') as patched_logger:
400-
Cluster(contact_points=['1'], load_balancing_policy=object())
400+
Cluster(contact_points=['127.0.0.1'], load_balancing_policy=object())
401401
patched_logger.warn.assert_not_called()

0 commit comments

Comments
 (0)