Commit Graph

114 Commits

Author SHA1 Message Date
Bernie Hackett
9d47f1cd3d PYTHON-691 - Fix UserWarning command issues.
Don't raise UserWarning for helpers and internal calls to
commands that do not obey read preference.
2014-05-01 09:21:52 -07:00
A. Jesse Jiryu Davis
47a851fe50 Skip test_max_time_ms_getmore on servers before 2.5.3. 2014-03-06 11:55:45 -05:00
A. Jesse Jiryu Davis
d0fca05fcf Improved testing for max_time_ms, PYTHON-550. 2014-03-05 12:09:13 -05:00
Bernie Hackett
22caa27a72 Add more tests for maxTimeMS PYTHON-550 2014-03-04 10:35:45 -08:00
Bernie Hackett
979d4e841c Fix a few more test issues. 2014-02-13 15:04:32 -08:00
Bernie Hackett
0b831cb831 Fix some test failures on MongoDB 1.8 2014-02-12 20:26:51 -08:00
Bernie Hackett
a217d30e72 Changes to make cursor testing easier. 2014-02-12 18:11:16 -08:00
Bernie Hackett
e3c809bd02 Gracefully kill cursor on capped rollover PYTHON-637
This change does a few things:

- Raises a new exception for CursorNotFound, inheriting from
OperationFailure so we don't break existing code.
- Catches the exception in cursor.Cursor and command_cursor.CommandCursor,
setting __killed to True.
- If the cursor is not tailable, re-raises the exception. This makes it
easier to deal with capped collection rollover when iterating a
tailable cursor.
2014-02-12 08:33:13 -08:00
Bernie Hackett
940d73f672 Add parallel_collection_scan helper PYTHON-633
This commit adds a helper for the new parallelCollectionScan
command introduced in MongoDB 2.5.5. The helper returns
"num_cursors" instances of CommandCursor that can be iterated
by one or more threads concurrently to scan the entire collection.

This commit also removes the remaining command cursor
hacks from cursor.Cursor.
2014-02-11 13:04:53 -08:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
Bernie Hackett
7fb681099d Skip comment test with mongos. 2014-01-22 16:46:44 -08:00
A. Jesse Jiryu Davis
872f76f724 Add _retrieved param to Cursor() for advanced use cases. 2014-01-09 16:02:19 -05:00
A. Jesse Jiryu Davis
277d856f26 Python 2.4 and 2.5 compatibility in test_cursor. 2013-12-14 14:07:17 -05:00
A. Jesse Jiryu Davis
793f64ff00 Test Cursor.min and max in test_clone. 2013-12-14 13:05:30 -05:00
A. Jesse Jiryu Davis
785b46a555 More reliable test_min and test_max. 2013-12-14 13:05:30 -05:00
A. Jesse Jiryu Davis
c97c3affb8 Adapt Cursor.min/max for compound indexes. 2013-12-14 13:05:30 -05:00
Karlis Lauva
b0d2a55702 Add Cursor.min and Cursor.max operators 2013-12-14 13:05:15 -05:00
A. Jesse Jiryu Davis
907d0ccff7 Call check_okay_to_chain() in Cursor.comment(). 2013-12-14 13:01:45 -05:00
A. Jesse Jiryu Davis
85ad5bd8dd Simplify test_comment. 2013-12-14 13:01:45 -05:00
A. Jesse Jiryu Davis
86f42f28bd Preserve 'comment' in Cursor.clone(). 2013-12-14 13:01:45 -05:00
A. Jesse Jiryu Davis
223d295021 Python 2.4 compatibility in test_comment. 2013-12-14 13:01:45 -05:00
Michael Henson
c936e182af Cursors now support setting comments 2013-12-14 13:01:45 -05:00
Bernie Hackett
0cb632784a Skip auth tests if auth not enabled PYTHON-556
This change does a few things:

1. In anticipation of the server defaulting to a "disabled" mode for
auth, only run authentication related tests if auth is enabled.
2. Attempt to clean up users in a finally block, even if tests failed.
3. Look for auth settings in "parsed" from getCmdLineOpts in case the
cluster was started with config files.
4. Remove useless remove_all_users calls at the beginning of tests - if
users were added in a previous test and we forgot to clean them up
these are going to fail no matter what when auth is enabled.
2013-11-05 09:10:00 -08:00
A. Jesse Jiryu Davis
e4cf504559 Option to not compile BSON regexes. PYTHON-500
Add a 'compile_re' parameter to Collection.find, Collection.find_one, and
json_util.loads. If it's False, regular expressions are encoded as a new class,
Regex, instead of passed to re.compile(). This allows PyMongo to handle regular
expressions that don't compile in Python but are valid in other contexts like
MongoDB queries.
2013-10-20 17:18:32 -04:00
Bernie Hackett
f0a419e5ff Clean up type checking in cursor.py PYTHON-565 2013-10-19 11:16:57 -07:00
hawka
5b1e852e4b PYTHON-550 changes to support maxTimeMS 2013-09-18 11:19:11 -04:00
A. Jesse Jiryu Davis
f1f7b14bf6 Allow MongoClients to be GC'ed after test runs.
Work around http://bugs.python.org/issue11798 to reduce max connection count during tests.
2013-08-27 09:00:50 -04:00
Bernie Hackett
9d9ac1c1da Fix various tests for mongos and old mongo versions. 2013-08-16 18:58:04 -07:00
behackett
334ea50af7 Fix add_option/remove_option issues PYTHON-546 2013-08-16 14:16:29 -07:00
behackett
4d42258697 Support exhaust cursor flag PYTHON-265 2013-08-05 11:29:11 -07:00
Ross Lawley
3f5cb6ff28 Fix cursor cloning issue with deepcopy and regex #179 2013-05-08 13:31:38 +00:00
A. Jesse Jiryu Davis
c758efcb34 Rename test_connection -> test_client, test_replica_set_connection -> test_replica_set_client PYTHON-451 2013-02-11 21:33:55 -05:00
A. Jesse Jiryu Davis
d35bec12e5 Tests use MongoClient instead of Connection PYTHON-451 2013-02-11 20:57:17 -05:00
Ross Lawley
828aad3aad Ensure deepcopy clones using the correct type - PYTHON-459 2013-01-08 09:53:39 +00:00
behackett
7603b9db79 Support "text" as an index specifier PYTHON-456
This also fixes a few documentation issues around
index types.
2013-01-04 10:44:16 -08:00
Ross Lawley
a36b836cbd Clone needs to handle regular expressions as well PYTHON-421 2012-11-08 09:08:24 +00:00
Ross Lawley
096c312e21 Implemented copy and deepcopy for cursors
Cursors now define __copy__ and __deepcopy__
and use the deepcopy implementation for clone()

PYTHON-421 PYTHON-399
2012-10-24 15:37:16 +00:00
Ross Lawley
8afa98dd55 Don't wrap query spec when querying $cmd - PYTHON-403
Don't include $readPreferences when querying $cmd unless
the command is ok to be sent to a secondary
2012-10-03 07:44:13 +00:00
A. Jesse Jiryu Davis
461e2529f7 Informative message whenever skipping a test 2012-08-21 23:24:47 -04:00
behackett
0ee7170cc2 It's 2012... 2012-04-19 12:40:38 -07:00
A. Jesse Jiryu Davis
266b3e97fa Fix kill-cursors tests and remove redundant tests 2012-04-16 14:13:07 -04:00
behackett
12592be1fe Python 3 unittest changes PYTHON-84. 2012-03-28 11:53:47 -07:00
behackett
2d21ba9376 Replace deprecated unittest assert method aliases.
assert_ -> assertTrue
assertEquals -> assertEqual

This is needed to clean up deprecation warnings
in python >= 3.2
2012-03-16 17:20:21 -07:00
A. Jesse Jiryu Davis
91d17eed98 PEP8 style compliance in unittesting code 2011-11-23 13:56:55 -05:00
A. Jesse Jiryu Davis
1869e60fe8 Add tests for cursor get_more() and for unique index creation with drop_dups=True on Mongo < 1.9.2 2011-11-23 10:17:56 -05:00
behackett
aeca6bf66e Add Cursor.close for use with PyPy, Jython, etc. 2011-09-19 12:11:16 -07:00
behackett
2e98b15e5f Add a few more tests PYTHON-277 2011-08-31 10:08:13 -07:00
Dan Crosta
522e4b4602 updated with bernie's help 2011-08-31 09:58:50 -07:00
behackett
42c2ce4dd6 Add a manipulate option to find(_one) PYTHON-224
Leaving this set to True by default so there are no
surprises when folks upgrade. We probably want to make
False the default in a later release.
2011-07-20 17:41:29 -07:00
behackett
9c47f3c649 Cursor add_option/remove_option PYTHON-242
You can now set and unset arbitrary query flags.

Set the tailable flag:
cursor = db.coll.find().add_option(2)

Now unset it:
cursor.remove_option(2)
2011-07-10 16:51:38 -07:00