From 57f301815dcddbb896b18701959458421b1e3097 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Thu, 16 Apr 2015 14:09:32 +0200 Subject: [PATCH 01/12] Added a tox.ini file allowing to test with different versions --- tox.ini | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tox.ini diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..6a3e0600 --- /dev/null +++ b/tox.ini @@ -0,0 +1,17 @@ +[tox] +envlist = + {py27,py32,py33,py34,pypy,pypy3}-{mg27,mg28,mg30}-{dj15,dj16,dj17,djdev}, + py26-{mg27,mg28,mg30}-{dj15,dj16} + +[testenv] +commands = + python setup.py test +deps = + mg27: PyMongo<2.8 + mg28: PyMongo>=2.8,<3.0 + mg30: PyMongo>=3.0 + mgdev: https://github.com/mongodb/mongo-python-driver/tarball/master + dj15: Django<1.6 + dj16: Django>=1.6,<1.7 + dj17: Django>=1.7,<1.8 + djdev: https://github.com/django/django/tarball/master From 8e8d9426df25536ce4b6aa6f18c7b45821f2ca73 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Thu, 16 Apr 2015 14:26:19 +0200 Subject: [PATCH 02/12] Document about tox testing --- CONTRIBUTING.rst | 2 ++ README.rst | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 8754896a..0ad7fd5c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -46,6 +46,8 @@ General Guidelines - Write tests and make sure they pass (make sure you have a mongod running on the default port, then execute ``python setup.py test`` from the cmd line to run the test suite). +- Ensure tests pass on every Python and PyMongo versions. + You can test on these versions locally by executing ``tox`` - Add yourself to AUTHORS :) Documentation diff --git a/README.rst b/README.rst index 1d01d8b7..59fbe194 100644 --- a/README.rst +++ b/README.rst @@ -8,10 +8,10 @@ MongoEngine .. image:: https://secure.travis-ci.org/MongoEngine/mongoengine.png?branch=master :target: http://travis-ci.org/MongoEngine/mongoengine - -.. image:: https://coveralls.io/repos/MongoEngine/mongoengine/badge.png?branch=master + +.. image:: https://coveralls.io/repos/MongoEngine/mongoengine/badge.png?branch=master :target: https://coveralls.io/r/MongoEngine/mongoengine?branch=master - + .. image:: https://landscape.io/github/MongoEngine/mongoengine/master/landscape.png :target: https://landscape.io/github/MongoEngine/mongoengine/master :alt: Code Health @@ -98,6 +98,17 @@ Tests To run the test suite, ensure you are running a local instance of MongoDB on the standard port, and run: ``python setup.py test``. +To run the test suite on every supported Python version and every supported PyMongo version, +you can use ``tox``. +tox and each supported Python version should be installed in your environment: + +.. code-block:: shell + + # Install tox + $ pip install tox + # Run the test suites + $ tox + Community ========= - `MongoEngine Users mailing list From 02c1ba39ad8a5cfbb27f51ef1844e3afd9f9d570 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Thu, 16 Apr 2015 16:13:01 +0200 Subject: [PATCH 03/12] Added Django 1.8 to tox --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 6a3e0600..61692f7c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - {py27,py32,py33,py34,pypy,pypy3}-{mg27,mg28,mg30}-{dj15,dj16,dj17,djdev}, + {py27,py32,py33,py34,pypy,pypy3}-{mg27,mg28,mg30}-{dj15,dj16,dj17,dj18,djdev}, py26-{mg27,mg28,mg30}-{dj15,dj16} [testenv] @@ -14,4 +14,5 @@ deps = dj15: Django<1.6 dj16: Django>=1.6,<1.7 dj17: Django>=1.7,<1.8 + dj18: Django>=1.8,<1.9 djdev: https://github.com/django/django/tarball/master From aa7bf7af1e7228c169fc788f3196966700c7055a Mon Sep 17 00:00:00 2001 From: mrigal Date: Fri, 17 Apr 2015 10:36:26 +0200 Subject: [PATCH 04/12] adapted setup.cfg to use nosetests standard and allow usage of --tests argument, documenting it in the readme --- README.rst | 5 +++++ setup.cfg | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 59fbe194..6e32d3f3 100644 --- a/README.rst +++ b/README.rst @@ -109,6 +109,11 @@ tox and each supported Python version should be installed in your environment: # Run the test suites $ tox +If you wish to run one single or selected tests, use the nosetest convention. It will find the folder, +eventually the file, go to the TestClass specified after the colon and eventually right to the single test. +Also use the -s argument if you want to print out whatever or access pdb while testing. +``python setup.py nosetests --tests tests/test_django.py:QuerySetTest.test_get_document_or_404 -s`` + Community ========= - `MongoEngine Users mailing list diff --git a/setup.cfg b/setup.cfg index 3f3faa8c..2ee0f499 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,5 +7,6 @@ detailed-errors = 1 #cover-html-dir = ../htmlcov #cover-package = mongoengine py3where = build -where = tests +#where = tests +tests = tests #tests = document/__init__.py \ No newline at end of file From 91ee85152c8ac830a4f01c9a6a1b856f77d2f9d0 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Fri, 17 Apr 2015 11:26:47 +0200 Subject: [PATCH 05/12] Tests/Tox/TravisCI improvements --- .travis.yml | 38 +++++++++++++++++++------------------- CONTRIBUTING.rst | 2 +- README.rst | 2 +- setup.cfg | 15 ++++++--------- setup.py | 2 +- tox.ini | 2 +- 6 files changed, 29 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37ec8cf7..cd5d953b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,20 +8,30 @@ python: - pypy - pypy3 env: -- PYMONGO=2.7.2 -- PYMONGO=2.8 +- PYMONGO=2.7 DJANGO=dev +- PYMONGO=2.7 DJANGO=1.8 +- PYMONGO=2.7 DJANGO=1.7 +- PYMONGO=2.7 DJANGO=1.6 +- PYMONGO=2.7 DJANGO=1.5 +- PYMONGO=2.8 DJANGO=dev +- PYMONGO=2.8 DJANGO=1.8 +- PYMONGO=2.8 DJANGO=1.7 +- PYMONGO=2.8 DJANGO=1.6 +- PYMONGO=2.8 DJANGO=1.5 matrix: exclude: - python: '2.6' - env: PYMONGO=2.7.2 + env: PYMONGO=2.7 DJANGO=dev - python: '2.6' env: PYMONGO=2.8 - python: '2.6' - env: PYMONGO=2.7.2 + env: PYMONGO=2.7 DJANGO=1.7 - python: '2.6' - env: PYMONGO=2.8 - allow_failures: - - python: pypy3 + env: PYMONGO=2.8 DJANGO=1.7 + - python: '2.6' + env: PYMONGO=2.7 DJANGO=1.8 + - python: '2.6' + env: PYMONGO=2.8 DJANGO=1.8 fast_finish: true before_install: - travis_retry sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 @@ -33,19 +43,9 @@ 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 -- if [[ $PYMONGO == 'dev' ]]; then travis_retry pip install https://github.com/mongodb/mongo-python-driver/tarball/master; - true; fi -- if [[ $PYMONGO != 'dev' ]]; then travis_retry pip install pymongo==$PYMONGO; true; - fi -- travis_retry pip install https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz#md5=1534bb15cf311f07afaa3aacba1c028b -- travis_retry pip install coveralls -- travis_retry python setup.py install +- travis_retry pip install tox>=1.9 script: -- travis_retry python setup.py test -- if [[ $TRAVIS_PYTHON_VERSION == '3.'* ]]; then 2to3 . -w; fi; -- coverage run --source=mongoengine setup.py test -- coverage report -m -- python benchmark.py +- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- with-coverage after_script: coveralls --verbose notifications: irc: irc.freenode.org#mongoengine diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0ad7fd5c..c935d5a3 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -44,7 +44,7 @@ General Guidelines - Avoid backward breaking changes if at all possible. - Write inline documentation for new classes and methods. - Write tests and make sure they pass (make sure you have a mongod - running on the default port, then execute ``python setup.py test`` + running on the default port, then execute ``python setup.py nosetests`` from the cmd line to run the test suite). - Ensure tests pass on every Python and PyMongo versions. You can test on these versions locally by executing ``tox`` diff --git a/README.rst b/README.rst index 6e32d3f3..2414ed16 100644 --- a/README.rst +++ b/README.rst @@ -96,7 +96,7 @@ Some simple examples of what MongoEngine code looks like:: Tests ===== To run the test suite, ensure you are running a local instance of MongoDB on -the standard port, and run: ``python setup.py test``. +the standard port, and run: ``python setup.py nosetests``. To run the test suite on every supported Python version and every supported PyMongo version, you can use ``tox``. diff --git a/setup.cfg b/setup.cfg index 2ee0f499..2aac6e1e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,12 +1,9 @@ [nosetests] -verbosity = 3 +rednose = 1 +verbosity = 2 detailed-errors = 1 -#with-coverage = 1 -#cover-erase = 1 -#cover-html = 1 -#cover-html-dir = ../htmlcov -#cover-package = mongoengine +cover-erase = 1 +cover-branches = 1 +cover-package = mongoengine py3where = build -#where = tests -tests = tests -#tests = document/__init__.py \ No newline at end of file +where = tests diff --git a/setup.py b/setup.py index 3ae5aeac..42794452 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,6 @@ init = os.path.join(os.path.dirname(__file__), 'mongoengine', '__init__.py') version_line = list(filter(lambda l: l.startswith('VERSION'), open(init)))[0] VERSION = get_version(eval(version_line.split('=')[-1])) -print(VERSION) CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -79,5 +78,6 @@ setup(name='mongoengine', classifiers=CLASSIFIERS, install_requires=['pymongo>=2.7.1'], test_suite='nose.collector', + setup_requires=['nose', 'rednose'], # Allow proper nose usage with setuptols and tox **extra_opts ) diff --git a/tox.ini b/tox.ini index 61692f7c..38517bdc 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ envlist = [testenv] commands = - python setup.py test + python setup.py nosetests {posargs} deps = mg27: PyMongo<2.8 mg28: PyMongo>=2.8,<3.0 From 15fcb57e2fe57a3b0b88a0440ca119fa9bd5d1ab Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Fri, 17 Apr 2015 16:08:31 +0200 Subject: [PATCH 06/12] Fix typo in travis config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cd5d953b..eda63217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ install: python-tk - travis_retry pip install tox>=1.9 script: -- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- with-coverage +- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage after_script: coveralls --verbose notifications: irc: irc.freenode.org#mongoengine From dc45920afbddf5873563b4f73841426c8605639a Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Fri, 17 Apr 2015 16:29:16 +0200 Subject: [PATCH 07/12] Added missing coveralls install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eda63217..1012d286 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ 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 -- travis_retry pip install tox>=1.9 +- travis_retry pip install tox>=1.9 coveralls script: - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage after_script: coveralls --verbose From 29d858d58c13a8e47636ea95bad6c1b76fe13764 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Fri, 17 Apr 2015 17:20:37 +0200 Subject: [PATCH 08/12] Removed the deprecated py3where parameter --- setup.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 2aac6e1e..e59f0fe2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,5 +5,4 @@ detailed-errors = 1 cover-erase = 1 cover-branches = 1 cover-package = mongoengine -py3where = build -where = tests +tests = tests From 050378fa72014c4ba6b0ff2f4ae92f516afefa2e Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Fri, 17 Apr 2015 17:20:57 +0200 Subject: [PATCH 09/12] Little README tuning --- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2414ed16..5a873e22 100644 --- a/README.rst +++ b/README.rst @@ -112,7 +112,10 @@ tox and each supported Python version should be installed in your environment: If you wish to run one single or selected tests, use the nosetest convention. It will find the folder, eventually the file, go to the TestClass specified after the colon and eventually right to the single test. Also use the -s argument if you want to print out whatever or access pdb while testing. -``python setup.py nosetests --tests tests/test_django.py:QuerySetTest.test_get_document_or_404 -s`` + +.. code-block:: shell + + $ python setup.py nosetests --tests tests/test_django.py:QuerySetTest.test_get_document_or_404 -s Community ========= From 76ea8c86b73cdbbadd4d80cf80fe606fc4d56389 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Sat, 18 Apr 2015 13:40:32 +0200 Subject: [PATCH 10/12] Use travis_retry on tox execution --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1012d286..51d33c59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ install: python-tk - travis_retry pip install tox>=1.9 coveralls script: -- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage +- travis_retry tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage after_script: coveralls --verbose notifications: irc: irc.freenode.org#mongoengine From 58c8cf1a3a83d0f61c4e23102aa199a68c49136e Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Wed, 22 Apr 2015 13:10:44 +0200 Subject: [PATCH 11/12] Split dependencies installation and test running avoing travis_retry on tests --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 51d33c59..46a71a2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,8 +44,9 @@ install: libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk - travis_retry pip install tox>=1.9 coveralls +- travis_retry tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- -e test script: -- travis_retry tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage +- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage after_script: coveralls --verbose notifications: irc: irc.freenode.org#mongoengine From c804c395ed293048c4e52ccd0717812c2438a73a Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Tue, 28 Apr 2015 20:31:13 +0200 Subject: [PATCH 12/12] Post rebase and Django removal tuning (and prepare for PyMongo 3) --- .travis.yml | 31 ++++++------------------------- README.rst | 3 +-- tox.ini | 10 ++-------- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46a71a2f..74f40929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,30 +8,11 @@ python: - pypy - pypy3 env: -- PYMONGO=2.7 DJANGO=dev -- PYMONGO=2.7 DJANGO=1.8 -- PYMONGO=2.7 DJANGO=1.7 -- PYMONGO=2.7 DJANGO=1.6 -- PYMONGO=2.7 DJANGO=1.5 -- PYMONGO=2.8 DJANGO=dev -- PYMONGO=2.8 DJANGO=1.8 -- PYMONGO=2.8 DJANGO=1.7 -- PYMONGO=2.8 DJANGO=1.6 -- PYMONGO=2.8 DJANGO=1.5 +- PYMONGO=2.7 +- PYMONGO=2.8 +# - PYMONGO=3.0 +# - PYMONGO=dev matrix: - exclude: - - python: '2.6' - env: PYMONGO=2.7 DJANGO=dev - - python: '2.6' - env: PYMONGO=2.8 - - python: '2.6' - env: PYMONGO=2.7 DJANGO=1.7 - - python: '2.6' - env: PYMONGO=2.8 DJANGO=1.7 - - python: '2.6' - env: PYMONGO=2.7 DJANGO=1.8 - - python: '2.6' - env: PYMONGO=2.8 DJANGO=1.8 fast_finish: true before_install: - travis_retry sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 @@ -44,9 +25,9 @@ install: libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk - travis_retry pip install tox>=1.9 coveralls -- travis_retry tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- -e test +- travis_retry tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -e test script: -- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO-dj$DJANGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage +- tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage after_script: coveralls --verbose notifications: irc: irc.freenode.org#mongoengine diff --git a/README.rst b/README.rst index 5a873e22..2d17313f 100644 --- a/README.rst +++ b/README.rst @@ -38,12 +38,11 @@ Dependencies 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 - 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 + MongoEngine always runs it's test suite against the latest patch version of each dependecy. e.g.: PyMongo 3.0.1 Examples ======== diff --git a/tox.ini b/tox.ini index 38517bdc..3f69b5e8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] -envlist = - {py27,py32,py33,py34,pypy,pypy3}-{mg27,mg28,mg30}-{dj15,dj16,dj17,dj18,djdev}, - py26-{mg27,mg28,mg30}-{dj15,dj16} +envlist = {py26,py27,py32,py33,py34,pypy,pypy3}-{mg27,mg28} +#envlist = {py26,py27,py32,py33,py34,pypy,pypy3}-{mg27,mg28,mg30,mgdev} [testenv] commands = @@ -11,8 +10,3 @@ deps = mg28: PyMongo>=2.8,<3.0 mg30: PyMongo>=3.0 mgdev: https://github.com/mongodb/mongo-python-driver/tarball/master - dj15: Django<1.6 - dj16: Django>=1.6,<1.7 - dj17: Django>=1.7,<1.8 - dj18: Django>=1.8,<1.9 - djdev: https://github.com/django/django/tarball/master