Skip to content

Commit fc0803a

Browse files
committed
change loop names to fix checks
1 parent 850f218 commit fc0803a

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

cassandra/io/asyncorereactor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def maybe_start(self):
237237
self._loop_lock.release()
238238

239239
if should_start:
240-
self._thread = Thread(target=self._run_loop, name="cassandra_driver_event_loop")
240+
self._thread = Thread(target=self._run_loop, name="asyncore_cassandra_driver_event_loop")
241241
self._thread.daemon = True
242242
self._thread.start()
243243

cassandra/io/twistedreactor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def maybe_start(self):
128128
with self._lock:
129129
if not reactor.running:
130130
self._thread = Thread(target=reactor.run,
131-
name="cassandra_driver_event_loop",
131+
name="cassandra_driver_twisted_event_loop",
132132
kwargs={'installSignalHandlers': False})
133133
self._thread.daemon = True
134134
self._thread.start()

tests/integration/standard/test_connection.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
import unittest # noqa
1919

2020
from functools import partial
21+
import logging
2122
from six.moves import range
2223
import sys
2324
import threading
2425
from threading import Thread, Event
2526
import time
27+
from unittest import SkipTest
2628

2729
from cassandra import ConsistencyLevel, OperationTimedOut
2830
from cassandra.cluster import NoHostAvailable, ConnectionShutdown, Cluster
@@ -43,6 +45,9 @@
4345
LibevConnection = None
4446

4547

48+
log = logging.getLogger(__name__)
49+
50+
4651
def setup_module():
4752
use_singledc()
4853

@@ -394,10 +399,14 @@ def test_connect_timeout(self):
394399
self.assertTrue(exception_thrown)
395400

396401
def test_subclasses_share_loop(self):
397-
class C1(AsyncoreConnection):
402+
403+
if self.klass not in (AsyncoreConnection, LibevConnection):
404+
raise SkipTest
405+
406+
class C1(self.klass):
398407
pass
399408

400-
class C2(AsyncoreConnection):
409+
class C2(self.klass):
401410
pass
402411

403412
clusterC1 = Cluster(connection_class=C1)
@@ -412,16 +421,18 @@ class C2(AsyncoreConnection):
412421

413422

414423
def get_eventloop_threads(name):
415-
import threading
416-
event_loops_threads = [thread for thread in threading.enumerate() if name == thread.name]
424+
all_threads = list(threading.enumerate())
425+
log.debug('all threads: {}'.format(all_threads))
426+
log.debug('all names: {}'.format([thread.name for thread in all_threads]))
427+
event_loops_threads = [thread for thread in all_threads if name == thread.name]
417428

418429
return event_loops_threads
419430

420431

421432
class AsyncoreConnectionTests(ConnectionTests, unittest.TestCase):
422433

423434
klass = AsyncoreConnection
424-
event_loop_name = "cassandra_driver_event_loop"
435+
event_loop_name = "asyncore_cassandra_driver_event_loop"
425436

426437
def setUp(self):
427438
if is_monkey_patched():

0 commit comments

Comments
 (0)