Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-mongoengine for openSUSE:Factory checked in at 2023-01-05 15:00:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mongoengine (Old) and /work/SRC/openSUSE:Factory/.python-mongoengine.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mongoengine" Thu Jan 5 15:00:38 2023 rev:6 rq:1055990 version:0.25.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mongoengine/python-mongoengine.changes 2022-06-12 17:43:08.234484536 +0200 +++ /work/SRC/openSUSE:Factory/.python-mongoengine.new.1563/python-mongoengine.changes 2023-01-05 15:00:57.201052056 +0100 @@ -1,0 +2,14 @@ +Wed Jan 4 19:57:30 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.25.0: + * Support MONGODB-AWS authentication mechanism (with + `authmechanismproperties`) #2507 + * Turning off dereferencing for the results of distinct query. #2663 + * Add tests against Mongo 5.0 in pipeline + * Drop support for Python 3.6 (EOL) + * Bug fix support for PyMongo>=4 to fix "pymongo.errors.InvalidOperation: + Cannot use MongoClient after close" + errors. #2627 + * Bug fix regarding uuidRepresentation that was case sensitive #2650 + +------------------------------------------------------------------- Old: ---- v0.24.1.tar.gz New: ---- v0.25.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mongoengine.spec ++++++ --- /var/tmp/diff_new_pack.Hxq4k0/_old 2023-01-05 15:00:57.749054944 +0100 +++ /var/tmp/diff_new_pack.Hxq4k0/_new 2023-01-05 15:00:57.753054965 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-mongoengine # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python3-%{**}} %global skip_python2 1 Name: python-mongoengine -Version: 0.24.1 +Version: 0.25.0 Release: 0 Summary: Python Object-Document Mapper for working with MongoDB License: MIT ++++++ v0.24.1.tar.gz -> v0.25.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/.github/workflows/github-actions.yml new/mongoengine-0.25.0/.github/workflows/github-actions.yml --- old/mongoengine-0.24.1/.github/workflows/github-actions.yml 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/.github/workflows/github-actions.yml 2022-12-28 11:56:22.000000000 +0100 @@ -6,15 +6,17 @@ push: branches: - master + # Manual trigger from Action page + workflow_dispatch: # release tags create: tags: - 'v[0-9]+\.[0-9]+\.[0-9]+*' env: - MONGODB_3_6: 3.6.14 - MONGODB_4_0: 4.0.23 - MONGODB_4_2: 4.2 + MONGODB_3_6: 3.6.23 + MONGODB_4_0: 4.0.28 MONGODB_4_4: 4.4 + MONGODB_5_0: "5.0" PYMONGO_3_4: 3.4 PYMONGO_3_6: 3.6 @@ -22,6 +24,7 @@ PYMONGO_3_11: 3.11 PYMONGO_3_12: 3.12 PYMONGO_4_0: 4.0 + PYMONGO_4_3: 4.3.2 MAIN_PYTHON_VERSION: 3.7 @@ -32,45 +35,46 @@ runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: '3.9' + check-latest: true - run: bash .github/workflows/install_ci_python_dep.sh - run: pre-commit run -a test: # Test suite run against recent python versions # and against a few combination of MongoDB and pymongo - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10", pypy3] + python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9] MONGODB: [$MONGODB_4_0] PYMONGO: [$PYMONGO_3_11] include: - python-version: 3.7 MONGODB: $MONGODB_3_6 PYMONGO: $PYMONGO_3_9 - - python-version: 3.7 - MONGODB: $MONGODB_4_2 - PYMONGO: $PYMONGO_3_9 - - python-version: 3.7 + - python-version: 3.8 MONGODB: $MONGODB_4_4 PYMONGO: $PYMONGO_3_11 - - python-version: 3.7 + - python-version: 3.9 MONGODB: $MONGODB_4_4 PYMONGO: $PYMONGO_3_12 - - python-version: 3.9 + - python-version: "3.10" MONGODB: $MONGODB_4_4 PYMONGO: $PYMONGO_4_0 + - python-version: "3.11" + MONGODB: $MONGODB_5_0 + PYMONGO: $PYMONGO_4_3 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: install mongo and ci dependencies run: | bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }} @@ -94,9 +98,10 @@ steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.7 + check-latest: true - name: install python dep run: | pip install -e . @@ -106,39 +111,31 @@ cd docs make html-readthedocs - build-n-publish-dummy: + build-dryrun: runs-on: ubuntu-latest needs: [linting, test, build_doc_dryrun] - if: github.event_name != 'pull_request' steps: - uses: actions/checkout@master - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.9 + check-latest: true - name: build dummy wheel for test-pypi run: | pip install wheel - python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel -# - name: publish test-pypi -# # Although working and recommended, test-pypi has a limit -# # in the size of projects so it's better to avoid publishing -# # until there is a way to garbage collect these dummy releases -# uses: pypa/gh-action-pypi-publish@master -# with: -# password: ${{ secrets.test_pypi_token }} -# repository_url: https://test.pypi.org/legacy/ + python setup.py sdist bdist_wheel build-n-publish: runs-on: ubuntu-latest - needs: [linting, test, build_doc_dryrun, build-n-publish-dummy] + needs: [linting, test, build_doc_dryrun, build-dryrun] if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@master - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.9 + check-latest: true # todo separate build from publish # https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have - name: build dummy wheel for test-pypi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/.github/workflows/install_mongo.sh new/mongoengine-0.25.0/.github/workflows/install_mongo.sh --- old/mongoengine-0.24.1/.github/workflows/install_mongo.sh 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/.github/workflows/install_mongo.sh 2022-12-28 11:56:22.000000000 +0100 @@ -9,6 +9,8 @@ mongo_build=mongodb-linux-x86_64-ubuntu1804-v${MONGODB}-latest elif [[ "$MONGODB" == *"4.4"* ]]; then mongo_build=mongodb-linux-x86_64-ubuntu1804-v${MONGODB}-latest +elif [[ "$MONGODB" == *"5.0"* ]]; then + mongo_build=mongodb-linux-x86_64-ubuntu1804-v${MONGODB}-latest fi wget http://fastdl.mongodb.org/linux/$mongo_build.tgz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/.pre-commit-config.yaml new/mongoengine-0.25.0/.pre-commit-config.yaml --- old/mongoengine-0.24.1/.pre-commit-config.yaml 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/.pre-commit-config.yaml 2022-12-28 11:56:22.000000000 +0100 @@ -1,26 +1,28 @@ fail_fast: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.4.0 hooks: - id: check-merge-conflict - id: debug-statements - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/ambv/black - rev: 22.1.0 + rev: 22.12.0 hooks: - id: black - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 hooks: - id: flake8 + additional_dependencies: + - importlib_metadata<5 - repo: https://github.com/asottile/pyupgrade - rev: v2.31.1 + rev: v3.3.1 hooks: - id: pyupgrade args: [--py36-plus] - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/README.rst new/mongoengine-0.25.0/README.rst --- old/mongoengine-0.24.1/README.rst 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/README.rst 2022-12-28 11:56:22.000000000 +0100 @@ -31,7 +31,7 @@ Supported MongoDB Versions ========================== -MongoEngine is currently tested against MongoDB v3.6, v4.0, v4.2 and v4.4. Future versions +MongoEngine is currently tested against MongoDB v3.6, v4.0, v4.4 and v5.0. Future versions should be supported as well, but aren't actively tested at the moment. Make sure to open an issue or submit a pull request if you experience any problems with a more recent MongoDB versions. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/docs/changelog.rst new/mongoengine-0.25.0/docs/changelog.rst --- old/mongoengine-0.24.1/docs/changelog.rst 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/docs/changelog.rst 2022-12-28 11:56:22.000000000 +0100 @@ -8,12 +8,24 @@ =========== - (Fill this out as you fix issues and develop your features). +Changes in 0.25.0 +================= +- Support MONGODB-AWS authentication mechanism (with `authmechanismproperties`) #2507 +- Turning off dereferencing for the results of distinct query. #2663 +- Add tests against Mongo 5.0 in pipeline +- Drop support for Python 3.6 (EOL) +- Bug fix support for PyMongo>=4 to fix "pymongo.errors.InvalidOperation: Cannot use MongoClient after close" + errors. #2627 + +Changes in 0.24.2 +================= +- Bug fix regarding uuidRepresentation that was case sensitive #2650 + Changes in 0.24.1 ================= - Allow pymongo<5.0 to be pulled - Don't use deprecated property for emptiness check in queryset base #2633 - Changes in 0.24.0 ================= - EnumField improvements: now ``choices`` limits the values of an enum to allow diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/docs/guide/connecting.rst new/mongoengine-0.25.0/docs/guide/connecting.rst --- old/mongoengine-0.24.1/docs/guide/connecting.rst 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/docs/guide/connecting.rst 2022-12-28 11:56:22.000000000 +0100 @@ -186,6 +186,10 @@ with switch_db(User, 'archive-user-db') as User: User(name='Ross').save() # Saves the 'archive-user-db' +.. note:: :func:`~mongoengine.context_managers.switch_db` when used on + a class that allow inheritance will change the database alias + for instances of a given class only - instances of subclasses will still use + the default database. Switch Collection ----------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/docs/guide/defining-documents.rst new/mongoengine-0.25.0/docs/guide/defining-documents.rst --- old/mongoengine-0.24.1/docs/guide/defining-documents.rst 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/docs/guide/defining-documents.rst 2022-12-28 11:56:22.000000000 +0100 @@ -113,6 +113,33 @@ :attr:`db_field` (Default: None) The MongoDB field name. + If set, operations in MongoDB will be performed with this value instead of the class attribute. + + This allows you to use a different attribute than the name of the field used in MongoDB. :: + + from mongoengine import * + + class Page(Document): + page_number = IntField(db_field="pageNumber") + + # Create a Page and save it + Page(page_number=1).save() + + # How 'pageNumber' is stored in MongoDB + Page.objects.as_pymongo() # [{'_id': ObjectId('629dfc45ee4cc407b1586b1f'), 'pageNumber': 1}] + + # Retrieve the object + page: Page = Page.objects.first() + + print(page.page_number) # prints 1 + + print(page.pageNumber) # raises AttributeError + + .. note:: If set, use the name of the attribute when defining indexes in the :attr:`meta` + dictionary rather than the :attr:`db_field` otherwise, :class:`~mongoengine.LookUpError` + will be raised. + + :attr:`required` (Default: False) If set to True and the field is not set on the document instance, a :class:`~mongoengine.ValidationError` will be raised when the document is diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/docs/guide/validation.rst new/mongoengine-0.25.0/docs/guide/validation.rst --- old/mongoengine-0.24.1/docs/guide/validation.rst 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/docs/guide/validation.rst 2022-12-28 11:56:22.000000000 +0100 @@ -19,7 +19,7 @@ .. code-block:: python - from mongoengine import Document, EmailField + from mongoengine import Document, EmailField, IntField class User(Document): email = EmailField() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/docs/requirements.txt new/mongoengine-0.25.0/docs/requirements.txt --- old/mongoengine-0.24.1/docs/requirements.txt 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/docs/requirements.txt 2022-12-28 11:56:22.000000000 +0100 @@ -2,3 +2,4 @@ sphinx-rtd-theme==0.5.0 readthedocs-sphinx-ext==2.1.1 docutils==0.17.1 +Jinja2<3.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/docs/upgrade.rst new/mongoengine-0.25.0/docs/upgrade.rst --- old/mongoengine-0.24.1/docs/upgrade.rst 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/docs/upgrade.rst 2022-12-28 11:56:22.000000000 +0100 @@ -77,7 +77,7 @@ ****** `QuerySet.aggregate_sum` and `QuerySet.aggregate_average` are dropped. Use -`QuerySet.sum` and `QuerySet.average` instead which use the aggreation framework +`QuerySet.sum` and `QuerySet.average` instead which use the aggregation framework by default from now on. 0.9.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/mongoengine/__init__.py new/mongoengine-0.25.0/mongoengine/__init__.py --- old/mongoengine-0.24.1/mongoengine/__init__.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/mongoengine/__init__.py 2022-12-28 11:56:22.000000000 +0100 @@ -29,7 +29,7 @@ ) -VERSION = (0, 24, 1) +VERSION = (0, 25, 0) def get_version(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/mongoengine/connection.py new/mongoengine-0.25.0/mongoengine/connection.py --- old/mongoengine-0.24.1/mongoengine/connection.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/mongoengine/connection.py 2022-12-28 11:56:22.000000000 +0100 @@ -58,6 +58,7 @@ password=None, authentication_source=None, authentication_mechanism=None, + authmechanismproperties=None, **kwargs, ): """Get the connection settings as a dict @@ -88,6 +89,7 @@ "password": password, "authentication_source": authentication_source, "authentication_mechanism": authentication_mechanism, + "authmechanismproperties": authmechanismproperties, } _check_db_name(conn_settings["name"]) @@ -158,6 +160,10 @@ ): conn_settings["read_preference"] = preference break + if "authmechanismproperties" in uri_options: + conn_settings["authmechanismproperties"] = uri_options[ + "authmechanismproperties" + ] else: resolved_hosts.append(entity) conn_settings["host"] = resolved_hosts @@ -166,7 +172,10 @@ kwargs.pop("slaves", None) kwargs.pop("is_slave", None) - if "uuidRepresentation" not in kwargs: + keys = { + key.lower() for key in kwargs.keys() + } # pymongo options are case insensitive + if "uuidrepresentation" not in keys: warnings.warn( "No uuidRepresentation is specified! Falling back to " "'pythonLegacy' which is the default for pymongo 3.x. " @@ -193,6 +202,7 @@ password=None, authentication_source=None, authentication_mechanism=None, + authmechanismproperties=None, **kwargs, ): """Register the connection settings. @@ -225,6 +235,7 @@ password=password, authentication_source=authentication_source, authentication_mechanism=authentication_mechanism, + authmechanismproperties=authmechanismproperties, **kwargs, ) _connection_settings[alias] = conn_settings @@ -235,9 +246,15 @@ from mongoengine import Document from mongoengine.base.common import _get_documents_by_db - if alias in _connections: - get_connection(alias=alias).close() - del _connections[alias] + connection = _connections.pop(alias, None) + if connection: + # MongoEngine may share the same MongoClient across multiple aliases + # if connection settings are the same so we only close + # the client if we're removing the final reference. + # Important to use 'is' instead of '==' because clients connected to the same cluster + # will compare equal even with different options + if all(connection is not c for c in _connections.values()): + connection.close() if alias in _dbs: # Detach all cached collections in Documents @@ -286,6 +303,7 @@ "password", "authentication_source", "authentication_mechanism", + "authmechanismproperties", } rename_fields = {} else: @@ -385,6 +403,7 @@ conn_settings["password"] or conn_settings["authentication_mechanism"] == "MONGODB-X509" ) + and conn_settings["authmechanismproperties"] is None ): auth_kwargs = {"source": conn_settings["authentication_source"]} if conn_settings["authentication_mechanism"] is not None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/mongoengine/queryset/base.py new/mongoengine-0.25.0/mongoengine/queryset/base.py --- old/mongoengine-0.24.1/mongoengine/queryset/base.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/mongoengine/queryset/base.py 2022-12-28 11:56:22.000000000 +0100 @@ -954,9 +954,11 @@ except LookUpError: pass - distinct = self._dereference( - queryset._cursor.distinct(field), 1, name=field, instance=self._document - ) + raw_values = queryset._cursor.distinct(field) + if not self._auto_dereference: + return raw_values + + distinct = self._dereference(raw_values, 1, name=field, instance=self._document) doc_field = self._document._fields.get(field.split(".", 1)[0]) instance = None @@ -1737,29 +1739,29 @@ def _item_frequencies_map_reduce(self, field, normalize=False): map_func = """ - function() { - var path = '{{~%(field)s}}'.split('.'); + function() {{ + var path = '{{{{~{field}}}}}'.split('.'); var field = this; - for (p in path) { + for (p in path) {{ if (typeof field != 'undefined') field = field[path[p]]; else break; - } - if (field && field.constructor == Array) { - field.forEach(function(item) { + }} + if (field && field.constructor == Array) {{ + field.forEach(function(item) {{ emit(item, 1); - }); - } else if (typeof field != 'undefined') { + }}); + }} else if (typeof field != 'undefined') {{ emit(field, 1); - } else { + }} else {{ emit(null, 1); - } - } - """ % { - "field": field - } + }} + }} + """.format( + field=field + ) reduce_func = """ function(key, values) { var total = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/setup.py new/mongoengine-0.25.0/setup.py --- old/mongoengine-0.24.1/setup.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/setup.py 2022-12-28 11:56:22.000000000 +0100 @@ -87,7 +87,7 @@ # import it as it depends on PyMongo and PyMongo isn't installed until this # file is read init = os.path.join(os.path.dirname(__file__), "mongoengine", "__init__.py") -version_line = list(filter(lambda l: l.startswith("VERSION"), open(init)))[0] +version_line = list(filter(lambda line: line.startswith("VERSION"), open(init)))[0] VERSION = get_version(eval(version_line.split("=")[-1])) @@ -141,7 +141,7 @@ long_description=LONG_DESCRIPTION, platforms=["any"], classifiers=CLASSIFIERS, - python_requires=">=3.6", + python_requires=">=3.7", install_requires=["pymongo>=3.4,<5.0"], cmdclass={"test": PyTest}, **extra_opts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/__init__.py new/mongoengine-0.25.0/tests/__init__.py --- old/mongoengine-0.24.1/tests/__init__.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/__init__.py 2022-12-28 11:56:22.000000000 +0100 @@ -0,0 +1,7 @@ +import os + +_THIS_MODULE = os.path.abspath(__file__) +TESTS_DIR = os.path.dirname(_THIS_MODULE) + +ROOT_DIR = os.path.dirname(TESTS_DIR) +DOCS_DIR = os.path.join(ROOT_DIR, "docs") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/document/test_instance.py new/mongoengine-0.25.0/tests/document/test_instance.py --- old/mongoengine-0.24.1/tests/document/test_instance.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/document/test_instance.py 2022-12-28 11:56:22.000000000 +0100 @@ -1735,7 +1735,7 @@ user = User.objects.first() # Even if stored as ObjectId's internally mongoengine uses DBRefs - # As ObjectId's aren't automatically derefenced + # As ObjectId's aren't automatically dereferenced assert isinstance(user._data["orgs"][0], DBRef) assert isinstance(user.orgs[0], Organization) assert isinstance(user._data["orgs"][0], Organization) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/fields/test_fields.py new/mongoengine-0.25.0/tests/fields/test_fields.py --- old/mongoengine-0.24.1/tests/fields/test_fields.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/fields/test_fields.py 2022-12-28 11:56:22.000000000 +0100 @@ -126,7 +126,7 @@ def test_default_values_set_to_None(self): """Ensure that default field values are used even when - we explcitly initialize the doc with None values. + we explicitly initialize the doc with None values. """ class Person(Document): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/fields/test_file_field.py new/mongoengine-0.25.0/tests/fields/test_file_field.py --- old/mongoengine-0.24.1/tests/fields/test_file_field.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/fields/test_file_field.py 2022-12-28 11:56:22.000000000 +0100 @@ -328,7 +328,7 @@ assert len(list(files)) == 1 assert len(list(chunks)) == 1 - # Deleting the docoument should delete the files + # Deleting the document should delete the files testfile.delete() files = db.fs.files.find() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/queryset/test_geo.py new/mongoengine-0.25.0/tests/queryset/test_geo.py --- old/mongoengine-0.24.1/tests/queryset/test_geo.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/queryset/test_geo.py 2022-12-28 11:56:22.000000000 +0100 @@ -237,7 +237,7 @@ assert events.count() == 0 def test_2dsphere_near_and_min_max_distance(self): - """Ensure "min_distace" and "max_distance" operators work well + """Ensure "min_distance" and "max_distance" operators work well together with the "near" operator in a 2dsphere index. """ event1, event2, event3 = self._create_event_data(point_field_class=PointField) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/queryset/test_queryset.py new/mongoengine-0.25.0/tests/queryset/test_queryset.py --- old/mongoengine-0.24.1/tests/queryset/test_queryset.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/queryset/test_queryset.py 2022-12-28 11:56:22.000000000 +0100 @@ -3505,6 +3505,7 @@ foo.save() assert Foo.objects.distinct("bar") == [bar] + assert Foo.objects.no_dereference().distinct("bar") == [bar.pk] def test_text_indexes(self): class News(Document): @@ -3711,6 +3712,7 @@ foo.save() assert Foo.objects.distinct("bar_lst") == [bar_1, bar_2] + assert Foo.objects.no_dereference().distinct("bar_lst") == [bar_1.pk, bar_2.pk] def test_custom_manager(self): """Ensure that custom QuerySetManager instances work as expected.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/test_changelog_consistency.py new/mongoengine-0.25.0/tests/test_changelog_consistency.py --- old/mongoengine-0.24.1/tests/test_changelog_consistency.py 1970-01-01 01:00:00.000000000 +0100 +++ new/mongoengine-0.25.0/tests/test_changelog_consistency.py 2022-12-28 11:56:22.000000000 +0100 @@ -0,0 +1,26 @@ +import os +from pathlib import Path + +from mongoengine import get_version +from tests import DOCS_DIR + + +def test_package_version_described_in_changelog(): + """Ensures that changelog is updated when version is incremented""" + version_str = get_version() + changelog_content = Path(os.path.join(DOCS_DIR, "changelog.rst")).read_text() + assert ( + version_str in changelog_content + ), "Version in __init__.py not present in changelog" + + +def test_package_version_incremented_when_new_version_added_to_changelog(): + """Ensures that changelog is updated when version is incremented""" + version_str = get_version() + changelog_content = Path(os.path.join(DOCS_DIR, "changelog.rst")).read_text() + + def find_between(s, start, end): + return (s.split(start))[1].split(end)[0] + + most_recent_version = find_between(changelog_content, start="Changes in ", end="\n") + assert most_recent_version == version_str diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tests/test_connection.py new/mongoengine-0.25.0/tests/test_connection.py --- old/mongoengine-0.24.1/tests/test_connection.py 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tests/test_connection.py 2022-12-28 11:56:22.000000000 +0100 @@ -5,7 +5,11 @@ import pytest from bson.tz_util import utc from pymongo import MongoClient, ReadPreference -from pymongo.errors import InvalidName, OperationFailure +from pymongo.errors import ( + InvalidName, + InvalidOperation, + OperationFailure, +) import mongoengine.connection from mongoengine import ( @@ -287,6 +291,30 @@ assert len(connections) == 0 disconnect(alias="not_exist") + def test_disconnect_does_not_close_client_used_by_another_alias(self): + client1 = connect(alias="disconnect_reused_client_test_1") + client2 = connect(alias="disconnect_reused_client_test_2") + client3 = connect(alias="disconnect_reused_client_test_3", maxPoolSize=10) + assert client1 is client2 + assert client1 is not client3 + client1.admin.command("ping") + disconnect("disconnect_reused_client_test_1") + # The client is not closed because the second alias still exists. + client2.admin.command("ping") + disconnect("disconnect_reused_client_test_2") + # The client is now closed: + if PYMONGO_VERSION >= (4,): + with pytest.raises(InvalidOperation): + client2.admin.command("ping") + # 3rd client connected to the same cluster with different options + # is not closed either. + client3.admin.command("ping") + disconnect("disconnect_reused_client_test_3") + # 3rd client is now closed: + if PYMONGO_VERSION >= (4,): + with pytest.raises(InvalidOperation): + client3.admin.command("ping") + def test_disconnect_all(self): connections = mongoengine.connection._connections dbs = mongoengine.connection._dbs @@ -418,7 +446,7 @@ db.list_collection_names() else: with pytest.raises(OperationFailure): - db = get_db() + get_db() def test_connect_uri_with_authsource(self): """Ensure that the connect() method works well with `authSource` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mongoengine-0.24.1/tox.ini new/mongoengine-0.25.0/tox.ini --- old/mongoengine-0.24.1/tox.ini 2022-03-21 21:50:55.000000000 +0100 +++ new/mongoengine-0.25.0/tox.ini 2022-12-28 11:56:22.000000000 +0100 @@ -11,5 +11,6 @@ mg311: pymongo>=3.11,<3.12 mg312: pymongo>=3.12,<3.13 mg4: pymongo>=4.0,<4.1 + mg432: pymongo>=4.3,<4.4 setenv = PYTHON_EGG_CACHE = {envdir}/python-eggs