diff --git a/docs/changelog.rst b/docs/changelog.rst index ca9ad6c80..64fe0dbbe 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -29,6 +29,7 @@ Changes in 1.0.0 - Fixed stacklevel of many warnings (to point places emitting the warning more accurately) - Add support for collation/hint/comment to delete/update and aggregate #2842 - BREAKING CHANGE: Remove LongField as it's equivalent to IntField since we drop support to Python2 long time ago (User should simply switch to IntField) #2309 +- BREAKING CHANGE: The obsolete ``slaves`` and ``is_slave`` connection options were silently ignored since 2014 and will now raise ``ConnectionFailure`` if provided #2920. - BugFix - Calling .clear on a ListField wasn't being marked as changed (and flushed to db upon .save()) #2858 - Improve error message in case a document assigned to a ReferenceField wasn't saved yet #1955 - BugFix - Take `where()` into account when using `.modify()`, as in MyDocument.objects().where("this[field] >= this[otherfield]").modify(field='new') #2044 diff --git a/mongoengine/connection.py b/mongoengine/connection.py index 4728cb377..448307f4a 100644 --- a/mongoengine/connection.py +++ b/mongoengine/connection.py @@ -203,10 +203,6 @@ def _get_connection_settings( resolved_hosts.append(entity) conn_settings["host"] = resolved_hosts - # Deprecated parameters that should not be passed on - kwargs.pop("slaves", None) - kwargs.pop("is_slave", None) - keys = { key.lower() for key in kwargs.keys() } # pymongo options are case insensitive diff --git a/tests/test_connection.py b/tests/test_connection.py index b41ef5826..42926e1a1 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -173,6 +173,17 @@ def test_connect_fails_if_connect_2_times_with_custom_alias(self): == str(exc_info.value) ) + def test_connect__obsolete_slave_options__raises_connection_failure(self): + obsolete_options = ({"slaves": []}, {"is_slave": True}) + + for options in obsolete_options: + option_name = next(iter(options)) + with self.subTest(options=options), pytest.raises( + ConnectionFailure + ) as exc_info: + connect(alias=random_str(), **options) + assert option_name in str(exc_info.value) + def test_connect_fails_if_similar_connection_settings_arent_defined_the_same_way( self, ):