Commit Graph
14 Commits
Author SHA1 Message Date
Bastien Gérard bc0c55e49a improve tests health (flake8 warnings) 2019-10-31 23:01:27 +01:00
Bastien Gérard ac25f4b98b ran unittest2pytest 2019-10-31 22:59:49 +01:00
Bastien Gérard 37ca79e9c5 fix black formatting 2019-10-31 22:39:53 +01:00
Stefan WójcikandGitHub 9170eea784 Rename MongoEngineConnectionError to ConnectionFailure (#2111)
I originally changed the exception name from `ConnectionError` to
`MongoEngineConnectionError` in
https://github.com/MongoEngine/mongoengine/pull/1428/commits/b02904ee750a30f8e2246a326376b40358543101,
inspired by landscape.io's package health report, which argued that
`ConnectionError` is already a built-in exception in Python 3 (which it is:
https://docs.python.org/3/library/exceptions.html#ConnectionError).

I do agree that we shouldn't override built-in exceptions. [0] That said, it’s
silly to add a "MongoEngine" prefix to any class within the `mongoengine`
module (and *especially* to *just one* exception class out of many). I've
decided to do what PyMongo does (
https://github.com/mongodb/mongo-python-driver/blob/8855a510a80a30268ffd4b90be65fb26929648e2/pymongo/errors.py#L59)
and call this exception `ConnectionFailure`.

Note that this is a breaking change and people will need to rename
`MongoEngineConnectionError`s in their code to `ConnectionFailure`. Moreover,
if they use PyMongo's `ConnectionFailure` for anything, they'll need to take
    extra care to avoid conflicts, e.g. by using:
```
from mongoengine import ConnectionFailure as MongoEngineConnectionFailure
```

[0] Note that some popular packages still overwrite `ConnectionError`, e.g.
https://github.com/kennethreitz/requests/blob/4983a9bde39c6320aa4f3e34e50dac6e263dab6f/requests/exceptions.py#L32
or
https://github.com/andymccurdy/redis-py/blob/0be4d2920684345eb52115c7142c39d65356e7d4/redis/exceptions.py#L8
2019-06-30 09:23:32 +02:00
Stefan WójcikandGitHub b47669403b Format the codebase using Black (#2109)
This commit:
1. Formats all of our existing code using `black`.
2. Adds a note about using `black` to `CONTRIBUTING.rst`.
3. Runs `black --check` as part of CI (failing builds that aren't properly formatted).
2019-06-27 13:05:54 +02:00
Bastien Gérard cf38ef70cb Remove more code related to supporting pymongo2 2019-05-15 22:23:35 +02:00
Bastien Gérard 35b7efe3f4 refactored deprecated pymongo methods in tests
- remove/count/add_user/insert
- added pymongo_support
2019-03-02 00:28:38 +01:00
Bastien Gérard c60c2ee8d0 fix minor styling issue in tests 2019-02-25 22:33:36 +01:00
Stefan WójcikandGitHub 835d3c3d18 Improve the health of this package (#1428) 2016-12-11 18:49:21 -05:00
mrigalandMatthieu Rigal 48316ba60d implemented global IS_PYMONGO_3 2015-05-07 12:47:29 +02:00
mrigalandMatthieu Rigal a34fa74eaa fix connection problems with pymongo3 and added tests 2015-05-07 12:47:29 +02:00
Ross Lawley 0cbd3663e4 Updated tests 2013-01-28 13:40:28 +00:00
Laine 91aa90ad4a Added Python 3 support to MongoEngine 2012-08-01 17:21:48 -07:00
Ross Lawley 65a2f8a68b Updated configs 2012-05-29 17:06:03 +01:00