Skip to content

Commit 5e4eb16

Browse files
authored
Merge pull request #289 from IlyaSkriblovsky/drop-py2
Drop Python 2 support
2 parents 5f04f83 + fb6ca86 commit 5e4eb16

33 files changed

+79
-140
lines changed

.github/workflows/txmongo.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python: ["3.8", "3.9", "3.10"]
10+
python: ["3.8", "3.9", "3.10", "3.11"]
1111
mongodb-version: ['4.2', '4.4']
1212
steps:
1313
- uses: actions/checkout@v3
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ubuntu-20.04
3434
strategy:
3535
matrix:
36-
python: ["3.8", "3.9", "3.10"]
36+
python: ["3.8", "3.9", "3.10", "3.11"]
3737
steps:
3838
- uses: actions/checkout@v3
3939
- name: Install MongoDB 4.4
@@ -49,4 +49,4 @@ jobs:
4949
- name: Install tox and any other packages
5050
run: pip install tox
5151
- name: Run tox
52-
run: tox -e advanced
52+
run: tox -e advanced

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protocol on non-blocking sockets. The API derives from the original PyMongo.
1919

2020
Compatibility
2121
-------------
22-
Python 2.7, 3.3+ and PyPy
22+
Python 3.8+
2323
MongoDB 2.6+
2424

2525
Installing

docs/source/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
master_doc = 'index'
5151

5252
# General information about the project.
53-
project = u'TxMongo'
54-
copyright = u'2021, Alexandre Fiori, Bret Curtis, Ilya Skriblovsky'
53+
project = 'TxMongo'
54+
copyright = '2021, Alexandre Fiori, Bret Curtis, Ilya Skriblovsky'
5555

5656
# The version info for the project you're documenting, acts as replacement for
5757
# |version| and |release|, also used in various other places throughout the
@@ -203,8 +203,8 @@
203203
# (source start file, target name, title,
204204
# author, documentclass [howto, manual, or own class]).
205205
latex_documents = [
206-
('index', 'TxMongo.tex', u'TxMongo Documentation',
207-
u'Alexandre Fiori, Bret Curtis', 'manual'),
206+
('index', 'TxMongo.tex', 'TxMongo Documentation',
207+
'Alexandre Fiori, Bret Curtis', 'manual'),
208208
]
209209

210210
# The name of an image file (relative to this directory) to place at the top of
@@ -233,8 +233,8 @@
233233
# One entry per manual page. List of tuples
234234
# (source start file, name, description, authors, manual section).
235235
man_pages = [
236-
('index', 'txmongo', u'TxMongo Documentation',
237-
[u'Alexandre Fiori, Bret Curtis'], 1)
236+
('index', 'txmongo', 'TxMongo Documentation',
237+
['Alexandre Fiori, Bret Curtis'], 1)
238238
]
239239

240240
# If true, show URL addresses after external links.
@@ -247,8 +247,8 @@
247247
# (source start file, target name, title, author,
248248
# dir menu entry, description, category)
249249
texinfo_documents = [
250-
('index', 'TxMongo', u'TxMongo Documentation',
251-
u'Alexandre Fiori, Bret Curtis', 'TxMongo', 'One line description of project.',
250+
('index', 'TxMongo', 'TxMongo Documentation',
251+
'Alexandre Fiori, Bret Curtis', 'TxMongo', 'One line description of project.',
252252
'Miscellaneous'),
253253
]
254254

examples/webapps/twistedweb_server.tac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ from twisted.application import service, internet
2727
class Root(Resource):
2828
isLeaf = False
2929

30-
class BaseHandler(object):
30+
class BaseHandler:
3131
isLeaf = True
3232
def __init__(self, db):
3333
self.db = db

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
"Operating System :: Microsoft :: Windows",
2626
"Operating System :: POSIX",
2727
"Programming Language :: Python",
28-
"Programming Language :: Python :: 2.7",
2928
"Programming Language :: Python :: 3",
30-
"Programming Language :: Python :: 3.3",
31-
"Programming Language :: Python :: 3.4",
32-
"Programming Language :: Python :: 3.5",
29+
"Programming Language :: Python :: 3.8",
30+
"Programming Language :: Python :: 3.9",
31+
"Programming Language :: Python :: 3.10",
32+
"Programming Language :: Python :: 3.11",
3333
"Programming Language :: Python :: Implementation :: CPython",
3434
"Programming Language :: Python :: Implementation :: PyPy",
3535
"Topic :: Database"]

tests/advanced/test_auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
1716
from unittest.mock import patch
1817
from pymongo.errors import OperationFailure
1918
import os

tests/advanced/test_replicaset.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
import signal
1917
from bson import SON
2018
from pymongo.errors import OperationFailure, AutoReconnect, ConfigurationError

tests/basic/test_aggregate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
from twisted.internet import defer
1917
from twisted.trial import unittest
2018
import txmongo

tests/basic/test_bulk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TestErrorHandling(SingleCollectionTest):
2929

3030
@defer.inlineCallbacks
3131
def setUp(self):
32-
yield super(TestErrorHandling, self).setUp()
32+
yield super().setUp()
3333
yield self.coll.insert_one({'_id': 1})
3434

3535
@defer.inlineCallbacks
@@ -136,7 +136,7 @@ class TestBulkUpdate(SingleCollectionTest):
136136

137137
@defer.inlineCallbacks
138138
def setUp(self):
139-
yield super(TestBulkUpdate, self).setUp()
139+
yield super().setUp()
140140
yield self.coll.insert_many([
141141
{'x': 42},
142142
{'y': 123},
@@ -191,7 +191,7 @@ class TestBulkDelete(SingleCollectionTest):
191191

192192
@defer.inlineCallbacks
193193
def setUp(self):
194-
yield super(TestBulkDelete, self).setUp()
194+
yield super().setUp()
195195
yield self.coll.insert_many([
196196
{'x': 42},
197197
{'x': 123},

tests/basic/test_cancel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _delay(time):
1818
return d
1919

2020

21-
class AssertCallbackNotCalled(object):
21+
class AssertCallbackNotCalled:
2222
"""
2323
Context manager that assures Deferred's callback was not called
2424
after it was cancelled. So we can be sure that Deferred's canceller

tests/basic/test_codec_options.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
import datetime
1917
from bson import SON
2018
from bson.codec_options import CodecOptions

tests/basic/test_collection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
Based on pymongo driver's test_collection.py
1717
"""
1818

19-
from __future__ import absolute_import, division
2019
from pymongo import errors
2120
from twisted.internet import defer
2221
from twisted.trial import unittest
@@ -127,7 +126,7 @@ def test_create_index(self):
127126

128127
yield coll.create_index(qf.sort(qf.ASCENDING("hello")))
129128
indices = yield coll.index_information()
130-
self.assert_(u"hello_1" in indices)
129+
self.assert_("hello_1" in indices)
131130

132131
yield coll.drop_indexes()
133132
count = len((yield coll.index_information()))
@@ -167,7 +166,7 @@ def test_ensure_index(self):
167166

168167
yield coll.ensure_index(qf.sort(qf.ASCENDING("hello")))
169168
indices = yield coll.index_information()
170-
self.assert_(u"hello_1" in indices)
169+
self.assert_("hello_1" in indices)
171170

172171
@defer.inlineCallbacks
173172
def test_index_info(self):

tests/basic/test_connection.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
1716
from unittest.mock import patch
1817
from time import time
1918
from twisted.trial import unittest
@@ -55,8 +54,6 @@ def test_uri_input(self):
5554
yield test.disconnect()
5655
test = connection.ConnectionPool("mongodb://127.0.0.1/dbname")
5756
yield test.disconnect()
58-
test = connection.ConnectionPool(u"mongodb://127.0.0.1/dbname")
59-
yield test.disconnect()
6057
self.assertRaises(AssertionError, connection.ConnectionPool, object)
6158
self.assertRaises(AssertionError, connection.ConnectionPool, 1)
6259

tests/basic/test_count.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
1716
from twisted.trial import unittest
1817
from twisted.internet import defer
1918
from txmongo import connection, gridfs

tests/basic/test_filters.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
from twisted.trial import unittest
1917
from twisted.internet import defer
2018
import txmongo

tests/basic/test_find_and_modify.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
from twisted.internet import defer
1917
from twisted.trial import unittest
2018
import txmongo

tests/basic/test_get_version.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
1716
from twisted.trial import unittest
1817
from twisted.internet import defer
1918
from txmongo import connection, gridfs

tests/basic/test_objects.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
import time
1917

2018
from io import BytesIO as StringIO
@@ -65,11 +63,11 @@ def test_Properties(self):
6563

6664
try:
6765
# names
68-
self.assertEqual(db.name, u"mydb")
69-
self.assertEqual(coll.name, u"mycol")
70-
self.assertEqual(coll.full_name, u"mydb.mycol")
71-
self.assertEqual(coll.subcoll.name, u"mycol.subcoll")
72-
self.assertEqual(coll.subcoll.full_name, u"mydb.mycol.subcoll")
66+
self.assertEqual(db.name, "mydb")
67+
self.assertEqual(coll.name, "mycol")
68+
self.assertEqual(coll.full_name, "mydb.mycol")
69+
self.assertEqual(coll.subcoll.name, "mycol.subcoll")
70+
self.assertEqual(coll.subcoll.full_name, "mydb.mycol.subcoll")
7371

7472
# database
7573
self.assertTrue(coll.database is db)
@@ -201,7 +199,7 @@ def test_GridFileObjects(self):
201199
with self.assertRaises(TypeError):
202200
yield grid_in_file.write(1)
203201
with self.assertRaises(TypeError):
204-
yield grid_in_file.write(u"0xDEADBEEF")
202+
yield grid_in_file.write("0xDEADBEEF")
205203
with self.assertRaises(AttributeError):
206204
_ = grid_in_file.test
207205
grid_in_file.test = 1
@@ -264,7 +262,7 @@ def test_GridFsObjects(self):
264262
db = conn.test
265263
yield self._drop_gridfs(db)
266264
gfs = GridFS(db) # Default collection
267-
yield gfs.delete(u"test")
265+
yield gfs.delete("test")
268266

269267
_ = gfs.new_file(filename="test_1", contentType="text/plain", chunk_size=65536)
270268
yield conn.disconnect()

tests/basic/test_protocol.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import, division
17-
1816
from bson import BSON
1917
from twisted.trial import unittest
2018
from twisted.internet import defer
@@ -26,7 +24,7 @@
2624
DELETE_SINGLE_REMOVE, CursorNotFound
2725

2826

29-
class _FakeTransport(object):
27+
class _FakeTransport:
3028
"""Catches all content that MongoClientProtocol wants to send over the wire"""
3129

3230
def __init__(self):

0 commit comments

Comments
 (0)