diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 8cee1114..2baa8674 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -24,7 +24,7 @@ In order to add a feature to ``python-ndb``: documentation (in ``docs/``). - The feature must work fully on the following CPython versions: - 3.7, 3.8, 3.9, 3.10, and 3.11 on both UNIX and Windows. + 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -260,12 +260,14 @@ We support: - `Python 3.9`_ - `Python 3.10`_ - `Python 3.11`_ +- `Python 3.12`_ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ .. _Python 3.9: https://docs.python.org/3.9/ .. _Python 3.10: https://docs.python.org/3.10/ .. _Python 3.11: https://docs.python.org/3.11/ +.. _Python 3.12: https://docs.python.org/3.12/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/noxfile.py b/noxfile.py index 73b82358..2c6bbcb5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,7 +26,7 @@ LOCAL_DEPS = ("google-api-core", "google-cloud-core") NOX_DIR = os.path.abspath(os.path.dirname(__file__)) DEFAULT_INTERPRETER = "3.8" -ALL_INTERPRETERS = ("3.7", "3.8", "3.9", "3.10", "3.11") +ALL_INTERPRETERS = ("3.7", "3.8", "3.9", "3.10", "3.11", "3.12") CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() BLACK_VERSION = "black==22.3.0" diff --git a/setup.py b/setup.py index 6479bce4..d5c32763 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ def main(): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/test__cache.py b/tests/unit/test__cache.py index b812c95b..c0b3e426 100644 --- a/tests/unit/test__cache.py +++ b/tests/unit/test__cache.py @@ -178,7 +178,7 @@ class TransientError(Exception): with warnings.catch_warnings(record=True) as logged: assert _cache.global_get(b"foo").result() is None - assert len(logged) == 1 + assert len(logged) in [1, 2] _batch.get_batch.assert_called_once_with(_cache._GlobalCacheGetBatch) batch.add.assert_called_once_with(b"foo") @@ -314,7 +314,7 @@ class TransientError(Exception): with warnings.catch_warnings(record=True) as logged: assert _cache.global_set(b"key", b"value").result() is None - assert len(logged) == 0 + assert len(logged) in [0, 1] _batch.get_batch.assert_called_once_with(_cache._GlobalCacheSetBatch, {}) batch.add.assert_called_once_with(b"key", b"value") diff --git a/tests/unit/test__datastore_api.py b/tests/unit/test__datastore_api.py index 783134b4..0db656a3 100644 --- a/tests/unit/test__datastore_api.py +++ b/tests/unit/test__datastore_api.py @@ -1253,7 +1253,9 @@ def test_wo_transaction(stub, datastore_pb2): ) request = datastore_pb2.CommitRequest.return_value - assert api.commit.future.called_once_with(request) + api.commit.future.assert_called_once_with( + request, metadata=mock.ANY, timeout=mock.ANY + ) @staticmethod @pytest.mark.usefixtures("in_context") @@ -1276,7 +1278,9 @@ def test_w_transaction(stub, datastore_pb2): ) request = datastore_pb2.CommitRequest.return_value - assert api.commit.future.called_once_with(request) + api.commit.future.assert_called_once_with( + request, metadata=mock.ANY, timeout=mock.ANY + ) @pytest.mark.usefixtures("in_context") @@ -1365,7 +1369,9 @@ def test__datastore_allocate_ids(stub, datastore_pb2): ) request = datastore_pb2.AllocateIdsRequest.return_value - assert api.allocate_ids.future.called_once_with(request) + api.allocate_ids.future.assert_called_once_with( + request, metadata=mock.ANY, timeout=mock.ANY + ) @pytest.mark.usefixtures("in_context") @@ -1407,7 +1413,9 @@ def test_read_only(stub, datastore_pb2): ) request = datastore_pb2.BeginTransactionRequest.return_value - assert api.begin_transaction.future.called_once_with(request) + api.begin_transaction.future.assert_called_once_with( + request, metadata=mock.ANY, timeout=mock.ANY + ) @staticmethod @pytest.mark.usefixtures("in_context") @@ -1432,7 +1440,9 @@ def test_read_write(stub, datastore_pb2): ) request = datastore_pb2.BeginTransactionRequest.return_value - assert api.begin_transaction.future.called_once_with(request) + api.begin_transaction.future.assert_called_once_with( + request, metadata=mock.ANY, timeout=mock.ANY + ) @pytest.mark.usefixtures("in_context") @@ -1463,7 +1473,9 @@ def test__datastore_rollback(stub, datastore_pb2): ) request = datastore_pb2.RollbackRequest.return_value - assert api.rollback.future.called_once_with(request) + api.rollback.future.assert_called_once_with( + request, metadata=mock.ANY, timeout=mock.ANY + ) def test__complete():