Skip to content

Commit

Permalink
Merge pull request #289 from IlyaSkriblovsky/drop-py2
Browse files Browse the repository at this point in the history
Drop Python 2 support
  • Loading branch information
psi29a authored Sep 17, 2024
2 parents 5f04f83 + fb6ca86 commit 5e4eb16
Show file tree
Hide file tree
Showing 33 changed files with 79 additions and 140 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/txmongo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]
mongodb-version: ['4.2', '4.4']
steps:
- uses: actions/checkout@v3
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Install MongoDB 4.4
Expand All @@ -49,4 +49,4 @@ jobs:
- name: Install tox and any other packages
run: pip install tox
- name: Run tox
run: tox -e advanced
run: tox -e advanced
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol on non-blocking sockets. The API derives from the original PyMongo.

Compatibility
-------------
Python 2.7, 3.3+ and PyPy
Python 3.8+
MongoDB 2.6+

Installing
Expand Down
16 changes: 8 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
master_doc = 'index'

# General information about the project.
project = u'TxMongo'
copyright = u'2021, Alexandre Fiori, Bret Curtis, Ilya Skriblovsky'
project = 'TxMongo'
copyright = '2021, Alexandre Fiori, Bret Curtis, Ilya Skriblovsky'

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion examples/webapps/twistedweb_server.tac
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ from twisted.application import service, internet
class Root(Resource):
isLeaf = False

class BaseHandler(object):
class BaseHandler:
isLeaf = True
def __init__(self, db):
self.db = db
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Database"]
Expand Down
1 change: 0 additions & 1 deletion tests/advanced/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division
from unittest.mock import patch
from pymongo.errors import OperationFailure
import os
Expand Down
2 changes: 0 additions & 2 deletions tests/advanced/test_replicaset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

import signal
from bson import SON
from pymongo.errors import OperationFailure, AutoReconnect, ConfigurationError
Expand Down
2 changes: 0 additions & 2 deletions tests/basic/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

from twisted.internet import defer
from twisted.trial import unittest
import txmongo
Expand Down
6 changes: 3 additions & 3 deletions tests/basic/test_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestErrorHandling(SingleCollectionTest):

@defer.inlineCallbacks
def setUp(self):
yield super(TestErrorHandling, self).setUp()
yield super().setUp()
yield self.coll.insert_one({'_id': 1})

@defer.inlineCallbacks
Expand Down Expand Up @@ -136,7 +136,7 @@ class TestBulkUpdate(SingleCollectionTest):

@defer.inlineCallbacks
def setUp(self):
yield super(TestBulkUpdate, self).setUp()
yield super().setUp()
yield self.coll.insert_many([
{'x': 42},
{'y': 123},
Expand Down Expand Up @@ -191,7 +191,7 @@ class TestBulkDelete(SingleCollectionTest):

@defer.inlineCallbacks
def setUp(self):
yield super(TestBulkDelete, self).setUp()
yield super().setUp()
yield self.coll.insert_many([
{'x': 42},
{'x': 123},
Expand Down
2 changes: 1 addition & 1 deletion tests/basic/test_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _delay(time):
return d


class AssertCallbackNotCalled(object):
class AssertCallbackNotCalled:
"""
Context manager that assures Deferred's callback was not called
after it was cancelled. So we can be sure that Deferred's canceller
Expand Down
2 changes: 0 additions & 2 deletions tests/basic/test_codec_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

import datetime
from bson import SON
from bson.codec_options import CodecOptions
Expand Down
5 changes: 2 additions & 3 deletions tests/basic/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Based on pymongo driver's test_collection.py
"""

from __future__ import absolute_import, division
from pymongo import errors
from twisted.internet import defer
from twisted.trial import unittest
Expand Down Expand Up @@ -127,7 +126,7 @@ def test_create_index(self):

yield coll.create_index(qf.sort(qf.ASCENDING("hello")))
indices = yield coll.index_information()
self.assert_(u"hello_1" in indices)
self.assert_("hello_1" in indices)

yield coll.drop_indexes()
count = len((yield coll.index_information()))
Expand Down Expand Up @@ -167,7 +166,7 @@ def test_ensure_index(self):

yield coll.ensure_index(qf.sort(qf.ASCENDING("hello")))
indices = yield coll.index_information()
self.assert_(u"hello_1" in indices)
self.assert_("hello_1" in indices)

@defer.inlineCallbacks
def test_index_info(self):
Expand Down
3 changes: 0 additions & 3 deletions tests/basic/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division
from unittest.mock import patch
from time import time
from twisted.trial import unittest
Expand Down Expand Up @@ -55,8 +54,6 @@ def test_uri_input(self):
yield test.disconnect()
test = connection.ConnectionPool("mongodb://127.0.0.1/dbname")
yield test.disconnect()
test = connection.ConnectionPool(u"mongodb://127.0.0.1/dbname")
yield test.disconnect()
self.assertRaises(AssertionError, connection.ConnectionPool, object)
self.assertRaises(AssertionError, connection.ConnectionPool, 1)

Expand Down
1 change: 0 additions & 1 deletion tests/basic/test_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division
from twisted.trial import unittest
from twisted.internet import defer
from txmongo import connection, gridfs
Expand Down
2 changes: 0 additions & 2 deletions tests/basic/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

from twisted.trial import unittest
from twisted.internet import defer
import txmongo
Expand Down
2 changes: 0 additions & 2 deletions tests/basic/test_find_and_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

from twisted.internet import defer
from twisted.trial import unittest
import txmongo
Expand Down
1 change: 0 additions & 1 deletion tests/basic/test_get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division
from twisted.trial import unittest
from twisted.internet import defer
from txmongo import connection, gridfs
Expand Down
16 changes: 7 additions & 9 deletions tests/basic/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

import time

from io import BytesIO as StringIO
Expand Down Expand Up @@ -65,11 +63,11 @@ def test_Properties(self):

try:
# names
self.assertEqual(db.name, u"mydb")
self.assertEqual(coll.name, u"mycol")
self.assertEqual(coll.full_name, u"mydb.mycol")
self.assertEqual(coll.subcoll.name, u"mycol.subcoll")
self.assertEqual(coll.subcoll.full_name, u"mydb.mycol.subcoll")
self.assertEqual(db.name, "mydb")
self.assertEqual(coll.name, "mycol")
self.assertEqual(coll.full_name, "mydb.mycol")
self.assertEqual(coll.subcoll.name, "mycol.subcoll")
self.assertEqual(coll.subcoll.full_name, "mydb.mycol.subcoll")

# database
self.assertTrue(coll.database is db)
Expand Down Expand Up @@ -201,7 +199,7 @@ def test_GridFileObjects(self):
with self.assertRaises(TypeError):
yield grid_in_file.write(1)
with self.assertRaises(TypeError):
yield grid_in_file.write(u"0xDEADBEEF")
yield grid_in_file.write("0xDEADBEEF")
with self.assertRaises(AttributeError):
_ = grid_in_file.test
grid_in_file.test = 1
Expand Down Expand Up @@ -264,7 +262,7 @@ def test_GridFsObjects(self):
db = conn.test
yield self._drop_gridfs(db)
gfs = GridFS(db) # Default collection
yield gfs.delete(u"test")
yield gfs.delete("test")

_ = gfs.new_file(filename="test_1", contentType="text/plain", chunk_size=65536)
yield conn.disconnect()
Expand Down
4 changes: 1 addition & 3 deletions tests/basic/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division

from bson import BSON
from twisted.trial import unittest
from twisted.internet import defer
Expand All @@ -26,7 +24,7 @@
DELETE_SINGLE_REMOVE, CursorNotFound


class _FakeTransport(object):
class _FakeTransport:
"""Catches all content that MongoClientProtocol wants to send over the wire"""

def __init__(self):
Expand Down
Loading

0 comments on commit 5e4eb16

Please sign in to comment.