From bb461b009f6aa0c64c6fb2cf845a4714ee324908 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 24 Jun 2014 19:39:27 +0300 Subject: [PATCH 01/15] Travis build improvements. The latest patch version of each Django minor version is used. The build now installs existing pymongo versions. The build now actually tests against the specified Django version. Replaced PIL with Pillow. Added PyPy and Python 3.4 to the build. Rebase Log: Installing Pillow instead of PIL for testing since it's recommended and it supports PyPy. Excluding Django versions that do not work with Python 3. Improved formatting of .travis.yml. Specifying Pillow 2.0.0 and above since it's the first version that is supported in Python 3. PIL should not be installed alongside Pillow. Also, I installed some libraries that both PIL and Pillow depend on. It seems I have to be explicit on all envvars in order to exclude Django 1.4 from the build matrix. The build is now installing pymongo versions that actually exist. openjpeg has a different name on Ubuntu 12.04. Restoring libz hack. Also installing all Pillow requirements just in case. Fixed the build matrix. Acting according to @BanzaiMan's advice in travis-ci/travis-ci/#1492. --- .travis.yml | 58 +++++++++++++++++++++++++++++++++++++++++------------ setup.py | 4 ++-- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5739909b..d00dde3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,22 +6,54 @@ python: - "2.7" - "3.2" - "3.3" + - "3.4" + - "pypy" env: - - PYMONGO=dev DJANGO=1.6 - - PYMONGO=dev DJANGO=1.5.5 - - PYMONGO=dev DJANGO=1.4.10 - - PYMONGO=2.5 DJANGO=1.6 - - PYMONGO=2.5 DJANGO=1.5.5 - - PYMONGO=2.5 DJANGO=1.4.10 - - PYMONGO=3.2 DJANGO=1.6 - - PYMONGO=3.2 DJANGO=1.5.5 - - PYMONGO=3.3 DJANGO=1.6 - - PYMONGO=3.3 DJANGO=1.5.5 + - PYMONGO=dev DJANGO=1.6.5 + - PYMONGO=dev DJANGO=1.5.8 + - PYMONGO=dev DJANGO=1.4.13 + - PYMONGO=2.5.2 DJANGO=1.6.5 + - PYMONGO=2.5.2 DJANGO=1.5.8 + - PYMONGO=2.5.2 DJANGO=1.4.13 + - PYMONGO=2.6.3 DJANGO=1.6.5 + - PYMONGO=2.6.3 DJANGO=1.5.8 + - PYMONGO=2.6.3 DJANGO=1.4.13 + - PYMONGO=2.7.1 DJANGO=1.6.5 + - PYMONGO=2.7.1 DJANGO=1.5.8 + - PYMONGO=2.7.1 DJANGO=1.4.13 + +matrix: + exclude: + - python: "3.2" + env: PYMONGO=dev DJANGO=1.4.13 + - python: "3.2" + env: PYMONGO=2.5.2 DJANGO=1.4.13 + - python: "3.2" + env: PYMONGO=2.6.3 DJANGO=1.4.13 + - python: "3.2" + env: PYMONGO=2.7.1 DJANGO=1.4.13 + - python: "3.3" + env: PYMONGO=dev DJANGO=1.4.13 + - python: "3.3" + env: PYMONGO=2.5.2 DJANGO=1.4.13 + - python: "3.3" + env: PYMONGO=2.6.3 DJANGO=1.4.13 + - python: "3.3" + env: PYMONGO=2.7.1 DJANGO=1.4.13 + - python: "3.4" + env: PYMONGO=dev DJANGO=1.4.13 + - python: "3.4" + env: PYMONGO=2.5.2 DJANGO=1.4.13 + - python: "3.4" + env: PYMONGO=2.6.3 DJANGO=1.4.13 + - python: "3.4" + env: PYMONGO=2.7.1 DJANGO=1.4.13 install: - - if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then cp /usr/lib/*/libz.so $VIRTUAL_ENV/lib/; fi - - if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install pil --use-mirrors ; true; fi + - sudo apt-get install python-dev python3-dev libopenjpeg-dev zlib1g-dev libjpeg-turbo8-dev libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk + - cp /usr/lib/*/libz.so $VIRTUAL_ENV/lib/ - if [[ $PYMONGO == 'dev' ]]; then pip install https://github.com/mongodb/mongo-python-driver/tarball/master; true; fi - - if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO --use-mirrors; true; fi + - if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO; true; fi + - pip install Django==$DJANGO - pip install https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz#md5=1534bb15cf311f07afaa3aacba1c028b - python setup.py install script: diff --git a/setup.py b/setup.py index 85707d00..40c27ebe 100644 --- a/setup.py +++ b/setup.py @@ -51,12 +51,12 @@ CLASSIFIERS = [ extra_opts = {"packages": find_packages(exclude=["tests", "tests.*"])} if sys.version_info[0] == 3: extra_opts['use_2to3'] = True - extra_opts['tests_require'] = ['nose', 'coverage', 'blinker', 'jinja2==2.6', 'django>=1.5.1'] + extra_opts['tests_require'] = ['nose', 'coverage', 'blinker', 'jinja2==2.6', 'Pillow>=2.0.0', 'django>=1.5.1'] if "test" in sys.argv or "nosetests" in sys.argv: extra_opts['packages'] = find_packages() extra_opts['package_data'] = {"tests": ["fields/mongoengine.png", "fields/mongodb_leaf.png"]} else: - extra_opts['tests_require'] = ['nose', 'coverage', 'blinker', 'django>=1.4.2', 'PIL', 'jinja2>=2.6', 'python-dateutil'] + extra_opts['tests_require'] = ['nose', 'coverage', 'blinker', 'django>=1.4.2', 'Pillow>=2.0.0', 'jinja2>=2.6', 'python-dateutil'] setup(name='mongoengine', version=VERSION, From 8e852bce02b14a0149c0e189642631edc2de31fe Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 10:58:00 +0300 Subject: [PATCH 02/15] Pillow provides a more descriptive error message, therefor the build failure. --- tests/fields/file_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fields/file_tests.py b/tests/fields/file_tests.py index 902b1512..7ae53e8a 100644 --- a/tests/fields/file_tests.py +++ b/tests/fields/file_tests.py @@ -279,7 +279,7 @@ class FileTest(unittest.TestCase): t.image.put(f) self.fail("Should have raised an invalidation error") except ValidationError, e: - self.assertEqual("%s" % e, "Invalid image: cannot identify image file") + self.assertEqual("%s" % e, "Invalid image: cannot identify image file %s" % f) t = TestImage() t.image.put(open(TEST_IMAGE_PATH, 'rb')) From adbbc656d41dbc7ecd33ae933c164efe3fd89316 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 11:12:40 +0300 Subject: [PATCH 03/15] Removing zlib hack since only PIL needs it. The build should pass without it. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d00dde3a..1265ba70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,6 @@ matrix: env: PYMONGO=2.7.1 DJANGO=1.4.13 install: - sudo apt-get install python-dev python3-dev libopenjpeg-dev zlib1g-dev libjpeg-turbo8-dev libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk - - cp /usr/lib/*/libz.so $VIRTUAL_ENV/lib/ - if [[ $PYMONGO == 'dev' ]]; then pip install https://github.com/mongodb/mongo-python-driver/tarball/master; true; fi - if [[ $PYMONGO != 'dev' ]]; then pip install pymongo==$PYMONGO; true; fi - pip install Django==$DJANGO From 8adf1cdd0212e18d26220d7e5997c3534c92a017 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 11:18:35 +0300 Subject: [PATCH 04/15] Fast finish the build if there are failures since we have a very large build matrix and each build takes a very long time. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1265ba70..4079855d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ env: - PYMONGO=2.7.1 DJANGO=1.4.13 matrix: + fast_finish: true exclude: - python: "3.2" env: PYMONGO=dev DJANGO=1.4.13 From fc3eda55c72e99f0b80bb37bf917099780c2f79e Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 11:32:41 +0300 Subject: [PATCH 05/15] Added a note about optional dependencies to the README file. --- README.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index cc4524ae..8c3ee26e 100644 --- a/README.rst +++ b/README.rst @@ -29,9 +29,18 @@ setup.py install``. Dependencies ============ -- pymongo 2.5+ +- pymongo>=2.5 - sphinx (optional - for documentation generation) +Optional Dependencies +--------------------- +- **Django Integration:** Django>=1.4.0 for Python 2.x or PyPy and Django>=1.5.0 for Python 3.x +- **Image Fields**: Pillow>=2.0.0 or PIL (not recommended since MongoEngine is tested with Pillow) +- dateutil>=2.1.0 + +.. note + MongoEngine always runs it's test suite against the latest patch version of each dependecy. e.g.: Django 1.6.5 + Examples ======== Some simple examples of what MongoEngine code looks like:: From fe2ef4e61c4bd44e5156542728b7755f30ef8148 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 11:39:08 +0300 Subject: [PATCH 06/15] Made the benchmark script compatitable with Python 3 and ensured it runs on every build. --- .travis.yml | 1 + benchmark.py | 41 +++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4079855d..fff35ca9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,7 @@ install: - python setup.py install script: - python setup.py test + - python benchmark.py notifications: irc: "irc.freenode.org#mongoengine" branches: diff --git a/benchmark.py b/benchmark.py index 16b2fd47..cb5e19d8 100644 --- a/benchmark.py +++ b/benchmark.py @@ -113,6 +113,7 @@ def main(): 4.68946313858 ---------------------------------------------------------------------------------------------------- """ + print("Benchmarking...") setup = """ from pymongo import MongoClient @@ -138,10 +139,10 @@ myNoddys = noddy.find() [n for n in myNoddys] # iterate """ - print "-" * 100 + print("-" * 100) print """Creating 10000 dictionaries - Pymongo""" t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) stmt = """ from pymongo import MongoClient @@ -161,10 +162,10 @@ myNoddys = noddy.find() [n for n in myNoddys] # iterate """ - print "-" * 100 + print("-" * 100) print """Creating 10000 dictionaries - Pymongo write_concern={"w": 0}""" t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) setup = """ from pymongo import MongoClient @@ -190,10 +191,10 @@ myNoddys = Noddy.objects() [n for n in myNoddys] # iterate """ - print "-" * 100 - print """Creating 10000 dictionaries - MongoEngine""" + print("-" * 100) + print("""Creating 10000 dictionaries - MongoEngine""") t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) stmt = """ for i in xrange(10000): @@ -208,10 +209,10 @@ myNoddys = Noddy.objects() [n for n in myNoddys] # iterate """ - print "-" * 100 + print("-" * 100) print """Creating 10000 dictionaries without continual assign - MongoEngine""" t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) stmt = """ for i in xrange(10000): @@ -224,10 +225,10 @@ myNoddys = Noddy.objects() [n for n in myNoddys] # iterate """ - print "-" * 100 + print("-" * 100) print """Creating 10000 dictionaries - MongoEngine - write_concern={"w": 0}, cascade = True""" t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) stmt = """ for i in xrange(10000): @@ -240,10 +241,10 @@ myNoddys = Noddy.objects() [n for n in myNoddys] # iterate """ - print "-" * 100 + print("-" * 100) print """Creating 10000 dictionaries - MongoEngine, write_concern={"w": 0}, validate=False, cascade=True""" t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) stmt = """ for i in xrange(10000): @@ -256,10 +257,10 @@ myNoddys = Noddy.objects() [n for n in myNoddys] # iterate """ - print "-" * 100 - print """Creating 10000 dictionaries - MongoEngine, write_concern={"w": 0}, validate=False""" + print("-" * 100) + print("""Creating 10000 dictionaries - MongoEngine, write_concern={"w": 0}, validate=False""") t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) stmt = """ for i in xrange(10000): @@ -272,11 +273,11 @@ myNoddys = Noddy.objects() [n for n in myNoddys] # iterate """ - print "-" * 100 - print """Creating 10000 dictionaries - MongoEngine, force_insert=True, write_concern={"w": 0}, validate=False""" + print("-" * 100) + print("""Creating 10000 dictionaries - MongoEngine, force_insert=True, write_concern={"w": 0}, validate=False""") t = timeit.Timer(stmt=stmt, setup=setup) - print t.timeit(1) + print(t.timeit(1)) if __name__ == "__main__": - main() \ No newline at end of file + main() From f44c8f120532f407b5eea6fed480183c8aa51758 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 13:11:32 +0300 Subject: [PATCH 07/15] Skipping a test that does not work on PyPy due to a PyPy bug/feature. --- tests/queryset/queryset.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/queryset/queryset.py b/tests/queryset/queryset.py index 7ff2965d..33f7dd91 100644 --- a/tests/queryset/queryset.py +++ b/tests/queryset/queryset.py @@ -3586,7 +3586,13 @@ class QuerySetTest(unittest.TestCase): [x for x in people] self.assertEqual(100, len(people._result_cache)) - self.assertEqual(None, people._len) + + import platform + + if platform.python_implementation() != "PyPy": + # PyPy evaluates __len__ when iterating with list comprehensions while CPython does not. + # This may be a bug in PyPy (PyPy/#1802) but it does not affect the behavior of MongoEngine. + self.assertEqual(None, people._len) self.assertEqual(q, 1) list(people) From 1914032e35ef917ea95efc192b8280858ff78c82 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 14:20:54 +0300 Subject: [PATCH 08/15] Missed some of the print statements in the benchmarks script. --- benchmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark.py b/benchmark.py index cb5e19d8..5613eaf8 100644 --- a/benchmark.py +++ b/benchmark.py @@ -210,7 +210,7 @@ myNoddys = Noddy.objects() """ print("-" * 100) - print """Creating 10000 dictionaries without continual assign - MongoEngine""" + print("""Creating 10000 dictionaries without continual assign - MongoEngine""") t = timeit.Timer(stmt=stmt, setup=setup) print(t.timeit(1)) @@ -242,7 +242,7 @@ myNoddys = Noddy.objects() """ print("-" * 100) - print """Creating 10000 dictionaries - MongoEngine, write_concern={"w": 0}, validate=False, cascade=True""" + print("""Creating 10000 dictionaries - MongoEngine, write_concern={"w": 0}, validate=False, cascade=True""") t = timeit.Timer(stmt=stmt, setup=setup) print(t.timeit(1)) From 7f7745071af87957cdc5705b409b96ed49a1e481 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 15:47:54 +0300 Subject: [PATCH 09/15] Found more print statements that were not turned into function calls. --- benchmark.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmark.py b/benchmark.py index 5613eaf8..d33e58db 100644 --- a/benchmark.py +++ b/benchmark.py @@ -140,7 +140,7 @@ myNoddys = noddy.find() """ print("-" * 100) - print """Creating 10000 dictionaries - Pymongo""" + print("""Creating 10000 dictionaries - Pymongo""") t = timeit.Timer(stmt=stmt, setup=setup) print(t.timeit(1)) @@ -163,7 +163,7 @@ myNoddys = noddy.find() """ print("-" * 100) - print """Creating 10000 dictionaries - Pymongo write_concern={"w": 0}""" + print("""Creating 10000 dictionaries - Pymongo write_concern={"w": 0}""") t = timeit.Timer(stmt=stmt, setup=setup) print(t.timeit(1)) @@ -226,7 +226,7 @@ myNoddys = Noddy.objects() """ print("-" * 100) - print """Creating 10000 dictionaries - MongoEngine - write_concern={"w": 0}, cascade = True""" + print("""Creating 10000 dictionaries - MongoEngine - write_concern={"w": 0}, cascade = True""") t = timeit.Timer(stmt=stmt, setup=setup) print(t.timeit(1)) From b8d568761e0e3130ce37d5675f8b218b11b88e29 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 25 Jun 2014 17:24:52 +0300 Subject: [PATCH 10/15] Getting rid of xrange since it's not in Python 3 and does not affect the benchmark. --- benchmark.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/benchmark.py b/benchmark.py index d33e58db..53ecf32c 100644 --- a/benchmark.py +++ b/benchmark.py @@ -15,7 +15,7 @@ def cprofile_main(): class Noddy(Document): fields = DictField() - for i in xrange(1): + for i in range(1): noddy = Noddy() for j in range(20): noddy.fields["key" + str(j)] = "value " + str(j) @@ -128,7 +128,7 @@ connection = MongoClient() db = connection.timeit_test noddy = db.noddy -for i in xrange(10000): +for i in range(10000): example = {'fields': {}} for j in range(20): example['fields']["key"+str(j)] = "value "+str(j) @@ -151,7 +151,7 @@ connection = MongoClient() db = connection.timeit_test noddy = db.noddy -for i in xrange(10000): +for i in range(10000): example = {'fields': {}} for j in range(20): example['fields']["key"+str(j)] = "value "+str(j) @@ -181,7 +181,7 @@ class Noddy(Document): """ stmt = """ -for i in xrange(10000): +for i in range(10000): noddy = Noddy() for j in range(20): noddy.fields["key"+str(j)] = "value "+str(j) @@ -197,7 +197,7 @@ myNoddys = Noddy.objects() print(t.timeit(1)) stmt = """ -for i in xrange(10000): +for i in range(10000): noddy = Noddy() fields = {} for j in range(20): @@ -215,7 +215,7 @@ myNoddys = Noddy.objects() print(t.timeit(1)) stmt = """ -for i in xrange(10000): +for i in range(10000): noddy = Noddy() for j in range(20): noddy.fields["key"+str(j)] = "value "+str(j) @@ -231,7 +231,7 @@ myNoddys = Noddy.objects() print(t.timeit(1)) stmt = """ -for i in xrange(10000): +for i in range(10000): noddy = Noddy() for j in range(20): noddy.fields["key"+str(j)] = "value "+str(j) @@ -247,7 +247,7 @@ myNoddys = Noddy.objects() print(t.timeit(1)) stmt = """ -for i in xrange(10000): +for i in range(10000): noddy = Noddy() for j in range(20): noddy.fields["key"+str(j)] = "value "+str(j) @@ -263,7 +263,7 @@ myNoddys = Noddy.objects() print(t.timeit(1)) stmt = """ -for i in xrange(10000): +for i in range(10000): noddy = Noddy() for j in range(20): noddy.fields["key"+str(j)] = "value "+str(j) From cae91ce0c564089b418d0fd508d80c7f923df949 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 26 Jun 2014 12:31:07 +0300 Subject: [PATCH 11/15] Convert codebase to Python 3 using 2to3 before running benchmarks. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fff35ca9..6281e6b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,7 @@ install: - python setup.py install script: - python setup.py test + - 2to3 . -w - python benchmark.py notifications: irc: "irc.freenode.org#mongoengine" From 0e7878b406bc23b46140edd54912e4491595fac4 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 26 Jun 2014 12:41:26 +0300 Subject: [PATCH 12/15] Only run 2to3 on Python 3.x. Makes sense no? --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6281e6b4..5f10339b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ install: - python setup.py install script: - python setup.py test - - 2to3 . -w + - if [[ $TRAVIS_PYTHON_VERSION == '3.'* ]]; then 2to3 . -w; fi; - python benchmark.py notifications: irc: "irc.freenode.org#mongoengine" From b02a31d4b920981f6b7330de23e78518f334cc0d Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Thu, 26 Jun 2014 14:44:44 +0100 Subject: [PATCH 13/15] Updated .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5739909b..c7397fd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,7 @@ python: - "3.3" env: - PYMONGO=dev DJANGO=1.6 - - PYMONGO=dev DJANGO=1.5.5 - - PYMONGO=dev DJANGO=1.4.10 + - PYMONGO=dev DJANGO=1.5.8 - PYMONGO=2.5 DJANGO=1.6 - PYMONGO=2.5 DJANGO=1.5.5 - PYMONGO=2.5 DJANGO=1.4.10 @@ -31,3 +30,4 @@ notifications: branches: only: - master + - "0.8" From dd51589f67fd02f3049aadea5268a79cd3799092 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Thu, 26 Jun 2014 16:02:40 +0100 Subject: [PATCH 14/15] Updates --- setup.py | 2 +- tests/document/instance.py | 4 ++-- tests/queryset/queryset.py | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 85707d00..25075275 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ setup(name='mongoengine', long_description=LONG_DESCRIPTION, platforms=['any'], classifiers=CLASSIFIERS, - install_requires=['pymongo>=2.5'], + install_requires=['pymongo>=2.7'], test_suite='nose.collector', **extra_opts ) diff --git a/tests/document/instance.py b/tests/document/instance.py index afb27e0d..6f04ac1d 100644 --- a/tests/document/instance.py +++ b/tests/document/instance.py @@ -57,7 +57,7 @@ class InstanceTest(unittest.TestCase): date = DateTimeField(default=datetime.now) meta = { 'max_documents': 10, - 'max_size': 90000, + 'max_size': 4096, } Log.drop_collection() @@ -75,7 +75,7 @@ class InstanceTest(unittest.TestCase): options = Log.objects._collection.options() self.assertEqual(options['capped'], True) self.assertEqual(options['max'], 10) - self.assertEqual(options['size'], 90000) + self.assertTrue(options['size'] >= 4096) # Check that the document cannot be redefined with different options def recreate_log_document(): diff --git a/tests/queryset/queryset.py b/tests/queryset/queryset.py index a2438e21..688b1bce 100644 --- a/tests/queryset/queryset.py +++ b/tests/queryset/queryset.py @@ -650,7 +650,7 @@ class QuerySetTest(unittest.TestCase): blogs.append(Blog(title="post %s" % i, posts=[post1, post2])) Blog.objects.insert(blogs, load_bulk=False) - self.assertEqual(q, 1) # 1 for the insert + self.assertEqual(q, 99) # profiling logs each doc now :( Blog.drop_collection() Blog.ensure_indexes() @@ -659,7 +659,7 @@ class QuerySetTest(unittest.TestCase): self.assertEqual(q, 0) Blog.objects.insert(blogs) - self.assertEqual(q, 2) # 1 for insert, and 1 for in bulk fetch + self.assertEqual(q, 100) # 99 or insert, and 1 for in bulk fetch Blog.drop_collection() @@ -3943,7 +3943,7 @@ class QuerySetTest(unittest.TestCase): if qs: pass - op = q.db.system.profile.find({"ns": + op = q.db.system.profile.find({"ns": {"$ne": "%s.system.indexes" % q.db.name}})[0] self.assertFalse('$orderby' in op['query'], @@ -3969,7 +3969,7 @@ class QuerySetTest(unittest.TestCase): } Person.drop_collection() - + Person(name="B").save() Person(name="C").save() Person(name="A").save() @@ -3979,13 +3979,13 @@ class QuerySetTest(unittest.TestCase): if Person.objects: pass - op = q.db.system.profile.find({"ns": + op = q.db.system.profile.find({"ns": {"$ne": "%s.system.indexes" % q.db.name}})[0] self.assertFalse('$orderby' in op['query'], 'BaseQuerySet must remove orderby from meta in boolen test') - self.assertEqual(Person.objects.first().name, 'A') + self.assertEqual(Person.objects.first().name, 'A') self.assertTrue(Person.objects._has_data(), 'Cursor has data and returned False') From eb9003187d4ce70bdbb32709fc6cb9f20ce7eb16 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Thu, 26 Jun 2014 16:13:01 +0100 Subject: [PATCH 15/15] Updated changelog & authors #673 --- AUTHORS | 1 + docs/changelog.rst | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/AUTHORS b/AUTHORS index 170a00e5..c86df67c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -191,3 +191,4 @@ that much better: * Damien Churchill (https://github.com/damoxc) * Jonathan Simon Prates (https://github.com/jonathansp) * Thiago Papageorgiou (https://github.com/tmpapageorgiou) + * Omer Katz (https://github.com/thedrow) diff --git a/docs/changelog.rst b/docs/changelog.rst index 51134238..b94388a1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,11 @@ Changelog ========= + +Changes in 0.9.X - DEV +====================== +- pypy support #673 + Changes in 0.8.7 ================ - Calling reload on deleted / nonexistant documents raises DoesNotExist (#538)