Skip to content

Commit bdea91b

Browse files
Fix twisted tests (PYTHON-1037) (datastax#1047)
* Fix test_custom_endpoint to work with twisted * Version gate twisted so it doesnt take forever to build on windows
1 parent ee8eaa7 commit bdea91b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

test-requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ unittest2
77
pytz
88
sure
99
pure-sasl
10-
twisted[tls]==19.2.1
10+
twisted; python_version >= '3.5'
11+
twisted[tls]==19.2.1; python_version < '3.5'
1112
gevent>=1.0
1213
eventlet
1314
cython>=0.20,<0.30

tests/integration/simulacron/test_endpoint.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,24 @@
2727
@total_ordering
2828
class AddressEndPoint(EndPoint):
2929

30-
def __init__(self, address):
30+
def __init__(self, address, port=9042):
3131
self._address = address
32+
self._port = port
3233

3334
@property
3435
def address(self):
3536
return self._address
3637

3738
@property
3839
def port(self):
39-
return None
40+
return self._port
4041

4142
def resolve(self):
42-
return self._address, 9042 # connection purpose
43+
return self._address, self._port # connection purpose
4344

4445
def __eq__(self, other):
4546
return isinstance(other, AddressEndPoint) and \
46-
self.address == other.address
47+
self.address == other.address
4748

4849
def __hash__(self):
4950
return hash(self.address)
@@ -99,7 +100,8 @@ def test_custom_endpoint(self):
99100
cluster = Cluster(
100101
contact_points=[AddressEndPoint('127.0.0.1')],
101102
protocol_version=PROTOCOL_VERSION,
102-
endpoint_factory=AddressEndPointFactory()
103+
endpoint_factory=AddressEndPointFactory(),
104+
compression=False,
103105
)
104106
cluster.connect(wait_for_all_pools=True)
105107

0 commit comments

Comments
 (0)