Skip to content

Commit e97d2dd

Browse files
committed
CASSPYTHON-13: Remove stale EventletConnection reference in _create_thread_pool_executor
This code path in cassandra/cluster.py was not part of the original upstream removal since it doesn't exist upstream; it's fork-specific. With eventletreactor deleted, the import always failed and the method always fell back to a plain ThreadPoolExecutor, so drop the dead branch.
1 parent c532d23 commit e97d2dd

3 files changed

Lines changed: 10 additions & 44 deletions

File tree

CONTRIBUTING.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ Running Unit Tests
7373
Unit tests can be run like so::
7474

7575
uv run pytest tests/unit
76-
EVENT_LOOP_MANAGER=gevent uv run pytest tests/unit/io/test_geventreactor.py
77-
EVENT_LOOP_MANAGER=eventlet uv run pytest tests/unit/io/test_eventletreactor.py
76+
EVENT_LOOP_MANAGER=asyncio uv run pytest tests/unit/io/test_asyncioreactor.py
7877

7978
You can run a specific test method like so::
8079

cassandra/cluster.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import re
3838
import queue
3939
import socket
40-
import sys
4140
import time
4241
from threading import Lock, RLock, Thread, Event
4342
import uuid
@@ -1548,39 +1547,12 @@ def _resolve_hostnames(self):
15481547

15491548
def _create_thread_pool_executor(self, **kwargs):
15501549
"""
1551-
Create a ThreadPoolExecutor for the cluster. In most cases, the built-in
1552-
`concurrent.futures.ThreadPoolExecutor` is used.
1553-
1554-
Python 3.7+ and Eventlet cause the `concurrent.futures.ThreadPoolExecutor`
1555-
to hang indefinitely. In that case, the user needs to have the `futurist`
1556-
package so we can use the `futurist.GreenThreadPoolExecutor` class instead.
1550+
Create a ThreadPoolExecutor for the cluster.
15571551
15581552
:param kwargs: All keyword args are passed to the ThreadPoolExecutor constructor.
15591553
:return: A ThreadPoolExecutor instance.
15601554
"""
1561-
tpe_class = ThreadPoolExecutor
1562-
if sys.version_info[0] >= 3 and sys.version_info[1] >= 7:
1563-
try:
1564-
from cassandra.io.eventletreactor import EventletConnection
1565-
is_eventlet = issubclass(self.connection_class, EventletConnection)
1566-
except:
1567-
# Eventlet is not available or can't be detected
1568-
return tpe_class(**kwargs)
1569-
1570-
if is_eventlet:
1571-
try:
1572-
from futurist import GreenThreadPoolExecutor
1573-
tpe_class = GreenThreadPoolExecutor
1574-
except ImportError:
1575-
# futurist is not available
1576-
raise ImportError(
1577-
("Python 3.7+ and Eventlet cause the `concurrent.futures.ThreadPoolExecutor` "
1578-
"to hang indefinitely. If you want to use the Eventlet reactor, you "
1579-
"need to install the `futurist` package to allow the driver to use "
1580-
"the GreenThreadPoolExecutor. See https://github.com/eventlet/eventlet/issues/508 "
1581-
"for more details."))
1582-
1583-
return tpe_class(**kwargs)
1555+
return ThreadPoolExecutor(**kwargs)
15841556

15851557
def register_user_type(self, keyspace, user_type, klass):
15861558
"""

pyproject.toml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ dev = [
4545
"pytest~=8.0",
4646
"PyYAML",
4747
"pure-sasl",
48-
"twisted[tls]",
49-
"gevent",
50-
"eventlet>=0.33.3",
48+
"cryptography>=42.0",
5149
"cython>=3.2",
5250
"setuptools",
5351
"packaging>=25.0",
@@ -165,18 +163,15 @@ test-extras = ["compress-lz4"]
165163
# so skipping is disabled (CASS_DRIVER_NO_SKIP=1): a missing dependency such as
166164
# libev fails loudly instead of being silently skipped. Tests that cannot run in
167165
# the default configuration are listed explicitly:
168-
# * event-loop reactor tests are run separately with the matching
169-
# EVENT_LOOP_MANAGER (gevent/eventlet/asyncio);
166+
# * the asyncio reactor test is run separately with EVENT_LOOP_MANAGER=asyncio;
170167
# * asyncore is deprecated and unavailable on modern Python, so it is ignored;
171168
# * column_encryption is disabled upstream (scylladb/python-driver#365);
172169
# * test_deserialize_date_range_month is disabled upstream (PYTHON-912).
173-
# PyPy uses the pp* override below. All Linux CPython reactor commands run with
170+
# PyPy uses the pp* override below. The Linux CPython reactor command runs with
174171
# CASS_DRIVER_NO_SKIP=1 so unexpected skips fail loudly.
175172
test-command = [
176-
"CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {package}/tests/unit -v --ignore={package}/tests/unit/column_encryption --ignore={package}/tests/unit/io/test_geventreactor.py --ignore={package}/tests/unit/io/test_eventletreactor.py --ignore={package}/tests/unit/io/test_asyncioreactor.py --ignore={package}/tests/unit/io/test_asyncorereactor.py -k 'not test_deserialize_date_range_month'",
177-
"EVENT_LOOP_MANAGER=gevent CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {package}/tests/unit/io/test_geventreactor.py -v",
173+
"CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {package}/tests/unit -v --ignore={package}/tests/unit/column_encryption --ignore={package}/tests/unit/io/test_asyncioreactor.py --ignore={package}/tests/unit/io/test_asyncorereactor.py -k 'not test_deserialize_date_range_month'",
178174
"EVENT_LOOP_MANAGER=asyncio CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {package}/tests/unit/io/test_asyncioreactor.py -v",
179-
"EVENT_LOOP_MANAGER=eventlet CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {package}/tests/unit/io/test_eventletreactor.py -v",
180175
]
181176

182177
[tool.cibuildwheel.macos]
@@ -185,10 +180,10 @@ build-frontend = "build"
185180
test-extras = ["compress-lz4"]
186181
# Same policy as Linux (extensions are mandatory here too, libev comes from
187182
# Homebrew). The extra -k exclusions are timing-sensitive tests that are flaky
188-
# on macOS runners. The gevent/eventlet/asyncio reactor test files only contain
189-
# those timing-sensitive timer tests, so they are not run separately here.
183+
# on macOS runners. The asyncio reactor test file only contains those
184+
# timing-sensitive timer tests, so it is not run separately here.
190185
test-command = [
191-
"CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {project}/tests/unit -v --ignore={project}/tests/unit/column_encryption --ignore={project}/tests/unit/io/test_geventreactor.py --ignore={project}/tests/unit/io/test_eventletreactor.py --ignore={project}/tests/unit/io/test_asyncioreactor.py --ignore={project}/tests/unit/io/test_asyncorereactor.py -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation or test_deserialize_date_range_month)'",
186+
"CASS_DRIVER_NO_SKIP=1 pytest --import-mode=append {project}/tests/unit -v --ignore={project}/tests/unit/column_encryption --ignore={project}/tests/unit/io/test_asyncioreactor.py --ignore={project}/tests/unit/io/test_asyncorereactor.py -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation or test_deserialize_date_range_month)'",
192187
]
193188

194189
[tool.cibuildwheel.windows]

0 commit comments

Comments
 (0)