Bastien Gérard
3e764d068c
fix remaining assertRaises
2019-10-31 22:59:49 +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
Bastien Gérard
5bcc679194
fix 2 pymongo deprecation warnings
2019-10-10 22:55:44 +02:00
Nuno Rodrigues
05a22d5a54
Extract test to its own method
2019-07-22 08:42:17 +00:00
Nuno Rodrigues
2424ece0c5
Fix a linting error
2019-07-16 13:40:46 +00:00
Nuno Rodrigues
2d02551d0a
Add test
2019-07-15 17:54:46 +01:00
Stefan Wójcik
9170eea784
Rename MongoEngineConnectionError to ConnectionFailure ( #2111 )
...
I originally changed the exception name from `ConnectionError` to
`MongoEngineConnectionError` in
b02904ee75
,
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 (
8855a510a8/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.
4983a9bde3/requests/exceptions.py (L32)
or
0be4d29206/redis/exceptions.py (L8)
2019-06-30 09:23:32 +02:00
Stefan Wójcik
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
84c42ed58c
Add tests
2019-06-04 22:35:42 +02:00
Bastien Gérard
cf38ef70cb
Remove more code related to supporting pymongo2
2019-05-15 22:23:35 +02:00
Bastien Gérard
ac64ade10f
remove dead code (related to pymongo2) + minor cleaning
2019-05-15 21:54:47 +02:00
Bastien Gérard
cb578c84e2
Merge branch 'master' of github.com:MongoEngine/mongoengine into disconnect
2019-04-25 22:15:48 +02:00
Bastien Gérard
565e1dc0ed
minor improvements
2019-04-25 22:11:43 +02:00
Bastien Gérard
b1e28d02f7
Improve connect/disconnect
...
- document disconnect + sample of usage
- add more test cases to prevent github issues regressions
2019-04-24 22:44:07 +02:00
Bastien Gérard
d1467c2f73
Fix connect/disconnect functions
...
- expose disconnect
- disconnect cleans _connection_settings
- disconnect cleans cached collection in Document._collection
- re-connecting with the same alias raise an error (must call disconnect in between)
2019-04-24 22:41:56 +02:00
Yurii Andrieiev
b5213097e8
Fail fast when db name is invalid
...
Without this commit save operation on first document would fail instead of immediate failure upon connection attempt. Such later failure is much less obvious.
2019-04-07 23:21:12 +03:00
Bastien Gérard
68497542b3
Bump the required version of pymongo to >=3.5
2019-03-17 22:04:19 +01: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
Bastien Gérard
003827e916
rewrote some poorly written assertions like: assertTrue(isinstance(a, b)) assertTrue(a==b) assertTrue(a!=b) assertTrue(a in b)
2018-09-06 21:47:06 +02:00
Erdenezul Batmunkh
5c4ce8754e
run tests only pymongo3 #1565
2017-10-02 23:15:37 +08:00
Erdenezul Batmunkh
2f075be6f8
parse read_preference from conn_host #1665
2017-10-02 22:46:27 +08:00
Stefan Wójcik
5f43c032f2
revamp the "connecting" user guide and test more ways of connecting to a replica set ( #1490 )
2017-02-26 21:29:06 -05:00
Omer Katz
2bedb36d7f
Test against multiple MongoDB versions in Travis ( #1074 )
2017-02-26 14:52:43 -05:00
Stefan Wójcik
e93a95d0cb
Test and document controlling the size of the connection pool ( #1489 )
2017-02-25 14:09:10 -05:00
Stefan Wójcik
c6240ca415
Test connection's write concern ( #1456 )
2016-12-29 12:37:38 -05:00
Stefan Wojcik
553f496d84
fix tests
2016-12-13 00:42:03 -05:00
Stefan Wojcik
65914fb2b2
fix the way MongoDB URI w/ ?replicaset is passed
2016-12-12 23:24:19 -05:00
Stefan Wójcik
835d3c3d18
Improve the health of this package ( #1428 )
2016-12-11 18:49:21 -05:00
Stefan Wójcik
f168682a68
Dont let the MongoDB URI override connection settings it doesnt explicitly specify ( #1421 )
2016-12-05 22:31:00 -05:00
Jeff Tharp
f7ac8cea90
Fix connecting to a list of hosts
2016-10-19 11:57:02 -07:00
Emmanuel Leblond
13897db6d3
Fix mongomock url prefix error during connection
2016-01-20 11:06:45 +01:00
RussellLuo
23f07fde5e
Add support for mocking MongoEngine based on mongomock
...
Using `mongomock://` scheme in URI enables the mocking. Fix #1045 .
2015-12-06 11:08:00 +08:00
Emmanuel Leblond
96cfbb201a
Replace use close method in pymongo
2015-08-04 18:02:57 +02:00
Matthieu Rigal
5c807f3dc8
Various test adjustments to improve stability independantly of execution order
2015-06-22 16:41:36 +02:00
Matthieu Rigal
c41dd6495d
corrected connection test for PyMongo3+
2015-05-07 12:47:31 +02:00
Matthieu Rigal
f4478fc762
removed sleep thanks to @seglberg suggestion
2015-05-07 12:47:31 +02:00
mrigal
48316ba60d
implemented global IS_PYMONGO_3
2015-05-07 12:47:29 +02:00
mrigal
a34fa74eaa
fix connection problems with pymongo3 and added tests
2015-05-07 12:47:29 +02:00
RussellLuo
b847bc0aba
Make test_connect_uri_with_authsource
to focus on the key point
2015-04-25 10:22:24 +08:00
RussellLuo
6eb0bc50e2
Add a test for "authSource" feature
2015-04-25 08:01:24 +08:00
Bob Cribbs
d9da75d1c0
Fix multiple connections aliases being rewritten
2014-09-01 23:26:01 +03:00
Ross Lawley
47ebac0276
Add authentication_source option to register_connection #178 #464 #573 #580 #590
2014-06-27 11:59:35 +01:00
Omer Katz
67a65a2aa9
Installing unittest2 on Python 2.6.
2014-06-26 11:17:57 +03:00
Omer Katz
29309dac9a
Mongo clients with the same settings should be shared since they manage a connection pool.
...
Also, I removed old code that was supposed to support Pymongo<2.1 which we don't support anymore.
2014-06-25 16:53:24 +03:00
Joe Friedl
7c254c6136
Use defaults when host and port are passed as None
2013-10-04 14:18:36 -04:00
Alexandr Morozov
f57569f553
Remove database name necessity in uri connection schema
2013-08-21 13:52:24 +04:00
Ross Lawley
fbe5df84c0
Remove users post uri test
2013-06-25 09:30:28 +00:00
Ross Lawley
e58b3390aa
Removed import with from future
2013-05-01 08:48:14 +00:00