Skip to content

Commit 5d4fd23

Browse files
authored
remove stale dependency on "sure" (#1227)
1 parent 0979b89 commit 5d4fd23

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def run_setup(extensions):
416416
include_package_data=True,
417417
install_requires=dependencies,
418418
extras_require=_EXTRAS_REQUIRE,
419-
tests_require=['pytest', 'PyYAML', 'pytz', 'sure'],
419+
tests_require=['pytest', 'PyYAML', 'pytz'],
420420
classifiers=[
421421
'Development Status :: 5 - Production/Stable',
422422
'Intended Audience :: Developers',

test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ scales
33
pytest
44
ccm>=3.1.5
55
pytz
6-
sure
76
pure-sasl
87
twisted[tls]
98
gevent

tests/integration/cqlengine/test_timestamp.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
from datetime import timedelta, datetime
1616
from unittest import mock
17-
import sure
1817
from uuid import uuid4
1918

2019
from cassandra.cqlengine import columns
@@ -44,7 +43,7 @@ def test_batch_is_included(self):
4443
with BatchQuery(timestamp=timedelta(seconds=30)) as b:
4544
TestTimestampModel.batch(b).create(count=1)
4645

47-
"USING TIMESTAMP".should.be.within(m.call_args[0][0].query_string)
46+
self.assertIn("USING TIMESTAMP", m.call_args[0][0].query_string)
4847

4948

5049
class CreateWithTimestampTest(BaseTimestampTest):
@@ -56,27 +55,27 @@ def test_batch(self):
5655

5756
query = m.call_args[0][0].query_string
5857

59-
query.should.match(r"INSERT.*USING TIMESTAMP")
60-
query.should_not.match(r"TIMESTAMP.*INSERT")
58+
self.assertRegex(query, r"INSERT.*USING TIMESTAMP")
59+
self.assertNotRegex(query, r"TIMESTAMP.*INSERT")
6160

6261
def test_timestamp_not_included_on_normal_create(self):
6362
with mock.patch.object(self.session, "execute") as m:
6463
TestTimestampModel.create(count=2)
6564

66-
"USING TIMESTAMP".shouldnt.be.within(m.call_args[0][0].query_string)
65+
self.assertNotIn("USING TIMESTAMP", m.call_args[0][0].query_string)
6766

6867
def test_timestamp_is_set_on_model_queryset(self):
6968
delta = timedelta(seconds=30)
7069
tmp = TestTimestampModel.timestamp(delta)
71-
tmp._timestamp.should.equal(delta)
70+
self.assertEqual(tmp._timestamp, delta)
7271

7372
def test_non_batch_syntax_integration(self):
7473
tmp = TestTimestampModel.timestamp(timedelta(seconds=30)).create(count=1)
75-
tmp.should.be.ok
74+
self.assertIsNotNone(tmp)
7675

7776
def test_non_batch_syntax_with_tll_integration(self):
7877
tmp = TestTimestampModel.timestamp(timedelta(seconds=30)).ttl(30).create(count=1)
79-
tmp.should.be.ok
78+
self.assertIsNotNone(tmp)
8079

8180
def test_non_batch_syntax_unit(self):
8281

@@ -85,7 +84,7 @@ def test_non_batch_syntax_unit(self):
8584

8685
query = m.call_args[0][0].query_string
8786

88-
"USING TIMESTAMP".should.be.within(query)
87+
self.assertIn("USING TIMESTAMP", query)
8988

9089
def test_non_batch_syntax_with_ttl_unit(self):
9190

@@ -95,7 +94,7 @@ def test_non_batch_syntax_with_ttl_unit(self):
9594

9695
query = m.call_args[0][0].query_string
9796

98-
query.should.match(r"USING TTL \d* AND TIMESTAMP")
97+
self.assertRegex(query, r"USING TTL \d* AND TIMESTAMP")
9998

10099

101100
class UpdateWithTimestampTest(BaseTimestampTest):
@@ -109,15 +108,15 @@ def test_instance_update_includes_timestamp_in_query(self):
109108
with mock.patch.object(self.session, "execute") as m:
110109
self.instance.timestamp(timedelta(seconds=30)).update(count=2)
111110

112-
"USING TIMESTAMP".should.be.within(m.call_args[0][0].query_string)
111+
self.assertIn("USING TIMESTAMP", m.call_args[0][0].query_string)
113112

114113
def test_instance_update_in_batch(self):
115114
with mock.patch.object(self.session, "execute") as m:
116115
with BatchQuery() as b:
117116
self.instance.batch(b).timestamp(timedelta(seconds=30)).update(count=2)
118117

119118
query = m.call_args[0][0].query_string
120-
"USING TIMESTAMP".should.be.within(query)
119+
self.assertIn("USING TIMESTAMP", query)
121120

122121

123122
class DeleteWithTimestampTest(BaseTimestampTest):
@@ -129,7 +128,7 @@ def test_non_batch(self):
129128
uid = uuid4()
130129
tmp = TestTimestampModel.create(id=uid, count=1)
131130

132-
TestTimestampModel.get(id=uid).should.be.ok
131+
self.assertIsNotNone(TestTimestampModel.get(id=uid))
133132

134133
tmp.timestamp(timedelta(seconds=5)).delete()
135134

@@ -143,15 +142,15 @@ def test_non_batch(self):
143142

144143
# calling .timestamp sets the TS on the model
145144
tmp.timestamp(timedelta(seconds=5))
146-
tmp._timestamp.should.be.ok
145+
self.assertIsNotNone(tmp._timestamp)
147146

148147
# calling save clears the set timestamp
149148
tmp.save()
150-
tmp._timestamp.shouldnt.be.ok
149+
self.assertIsNone(tmp._timestamp)
151150

152151
tmp.timestamp(timedelta(seconds=5))
153152
tmp.update()
154-
tmp._timestamp.shouldnt.be.ok
153+
self.assertIsNone(tmp._timestamp)
155154

156155
def test_blind_delete(self):
157156
"""
@@ -160,7 +159,7 @@ def test_blind_delete(self):
160159
uid = uuid4()
161160
tmp = TestTimestampModel.create(id=uid, count=1)
162161

163-
TestTimestampModel.get(id=uid).should.be.ok
162+
self.assertIsNotNone(TestTimestampModel.get(id=uid))
164163

165164
TestTimestampModel.objects(id=uid).timestamp(timedelta(seconds=5)).delete()
166165

@@ -179,7 +178,7 @@ def test_blind_delete_with_datetime(self):
179178
uid = uuid4()
180179
tmp = TestTimestampModel.create(id=uid, count=1)
181180

182-
TestTimestampModel.get(id=uid).should.be.ok
181+
self.assertIsNotNone(TestTimestampModel.get(id=uid))
183182

184183
plus_five_seconds = datetime.now() + timedelta(seconds=5)
185184

@@ -197,7 +196,7 @@ def test_delete_in_the_past(self):
197196
uid = uuid4()
198197
tmp = TestTimestampModel.create(id=uid, count=1)
199198

200-
TestTimestampModel.get(id=uid).should.be.ok
199+
self.assertIsNotNone(TestTimestampModel.get(id=uid))
201200

202201
# delete in the past, should not affect the object created above
203202
TestTimestampModel.objects(id=uid).timestamp(timedelta(seconds=-60)).delete()

0 commit comments

Comments
 (0)