From 9ec72d2495c1cc7e39c0e532435d526f90fb2ed2 Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Sun, 26 Jun 2016 21:35:18 -0500 Subject: [PATCH 1/7] Add Django 1.10 beta to test matrix --- .travis.yml | 6 ++++++ tox.ini | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2723b9a..bfc354a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,15 +8,21 @@ env: - TOXENV=flake8 - TOXENV=docs # Supported Python / Django versions w/ SQLite + - TOXENV=py27-django-110 + - TOXENV=py35-django-110 - TOXENV=py27-django-19 - TOXENV=py35-django-19 - TOXENV=py27-django-18 - TOXENV=py34-django-18 # Test with PostgreSQL + - TOXENV=py27-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-110-postgres" + - TOXENV=py35-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-110-postgres" - TOXENV=py27-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-19-postgres" - TOXENV=py35-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-19-postgres" - TOXENV=py27-django-18-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-18-postgres" # Test with MySQL + - TOXENV=py27-django-110-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-110-mysql" + - TOXENV=py35-django-110-mysql DATABASE_URL="mysql://travis@localhost:3306/py35-django-110-mysql" - TOXENV=py27-django-19-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-19-mysql" - TOXENV=py35-django-19-mysql DATABASE_URL="mysql://travis@localhost:3306/py35-django-19-mysql" - TOXENV=py27-django-18-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-18-mysql" diff --git a/tox.ini b/tox.ini index 4256a6d..fd3f0ca 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] envlist = - {py27,py34,py35}-django-{18,19} - {py27,py34,py35}-django-master + {py27,py34,py35}-django-{18,19,110,master} flake8 docs skip_missing_interpreters = True @@ -15,10 +14,11 @@ deps = coveralls dj-database-url django-18: Django>=1.8,<1.9 - django-19: Django==1.9,<1.10 + django-19: Django>=1.9,<1.10 + django-110: Django==1.10b1 django-master: https://github.com/django/django/archive/master.tar.gz - {py27,py34,py35}-django-{18,19,master}-postgres: psycopg2 - {py27,py34,py35}-django-{18,19,master}-mysql: mysqlclient + {py27,py34,py35}-django-{18,19,110,master}-postgres: psycopg2 + {py27,py34,py35}-django-{18,19,110,master}-mysql: mysqlclient [testenv:flake8] deps = From 7f961ac05e610f6ad22bdd3ca1cad2fff11b8724 Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Sun, 26 Jun 2016 22:05:09 -0500 Subject: [PATCH 2/7] Drop South references South was integrated into the Django 1.7 release, and is no longer needed for integration with supported Django releases. --- docs/usage.rst | 10 ----- setup.cfg | 1 - setup.py | 1 - testapp/settings.py | 4 -- testapp/south_migrations/0001_initial.py | 54 ------------------------ testapp/south_migrations/__init__.py | 1 - 6 files changed, 71 deletions(-) delete mode 100644 testapp/south_migrations/0001_initial.py delete mode 100644 testapp/south_migrations/__init__.py diff --git a/docs/usage.rst b/docs/usage.rst index ffbc1ca..219d190 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -177,16 +177,6 @@ and some of its own as functions. :: assert_mail_count(count, msg=None) -Using With South ----------------- - -`South`_ installs its own test command that turns off migrations during -testing. Make sure that django-nose comes *after* ``south`` in -``INSTALLED_APPS`` so that django_nose's test command is used. - -.. _South: http://south.aeracode.org/ - - Always Passing The Same Options ------------------------------- diff --git a/setup.cfg b/setup.cfg index b9640ea..6fe40b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,6 @@ source = django_nose,testapp,unittests [coverage:report] omit = - testapp/south_migrations/*.py testapp/migrations/*.py [flake8] diff --git a/setup.py b/setup.py index 2b9f8fc..1a4843e 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,6 @@ def get_long_description(title): include_package_data=True, zip_safe=False, install_requires=['nose>=1.2.1'], - tests_require=['south>=0.7'], test_suite='testapp.runtests.runtests', # This blows up tox runs that install django-nose into a virtualenv, # because it causes Nose to import django_nose.runner before the Django diff --git a/testapp/settings.py b/testapp/settings.py index d204545..51a157f 100644 --- a/testapp/settings.py +++ b/testapp/settings.py @@ -32,10 +32,6 @@ def rel_path(*subpaths): 'django_nose', 'testapp', ] -if environ.get('USE_SOUTH', '0') in (1, '1'): - import south # Raise ImportError if not installed - assert south - INSTALLED_APPS.insert(0, 'south') raw_test_runner = environ.get('TEST_RUNNER') if raw_test_runner: diff --git a/testapp/south_migrations/0001_initial.py b/testapp/south_migrations/0001_initial.py deleted file mode 100644 index 021b439..0000000 --- a/testapp/south_migrations/0001_initial.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# flake8: noqa -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Question' - db.create_table('testapp_question', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('question_text', self.gf('django.db.models.fields.CharField')(max_length=200)), - ('pub_date', self.gf('django.db.models.fields.DateTimeField')()), - )) - db.send_create_signal('testapp', ['Question']) - - # Adding model 'Choice' - db.create_table('testapp_choice', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['testapp.Question'])), - ('choice_text', self.gf('django.db.models.fields.CharField')(max_length=200)), - ('votes', self.gf('django.db.models.fields.IntegerField')(default=0)), - )) - db.send_create_signal('testapp', ['Choice']) - - - def backwards(self, orm): - # Deleting model 'Question' - db.delete_table('testapp_question') - - # Deleting model 'Choice' - db.delete_table('testapp_choice') - - - models = { - 'testapp.choice': { - 'Meta': {'object_name': 'Choice'}, - 'choice_text': ('django.db.models.fields.CharField', [], {'max_length': '200'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['testapp.Question']"}), - 'votes': ('django.db.models.fields.IntegerField', [], {'default': '0'}) - }, - 'testapp.question': { - 'Meta': {'object_name': 'Question'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pub_date': ('django.db.models.fields.DateTimeField', [], {}), - 'question_text': ('django.db.models.fields.CharField', [], {'max_length': '200'}) - } - } - - complete_apps = ['testapp'] diff --git a/testapp/south_migrations/__init__.py b/testapp/south_migrations/__init__.py deleted file mode 100644 index 48f2e4f..0000000 --- a/testapp/south_migrations/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""South migrations for Django 1.6 and earlier.""" From 3e9bb8c1e6746eac520454f4c2ff5f5e4b22bcc3 Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Sun, 26 Jun 2016 22:11:32 -0500 Subject: [PATCH 3/7] Remove run_tests entrypoint This entrypoint was for supporting Django<1.2, which is now unsupported. --- django_nose/__init__.py | 2 +- runtests.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/django_nose/__init__.py b/django_nose/__init__.py index a35003e..b7ef098 100644 --- a/django_nose/__init__.py +++ b/django_nose/__init__.py @@ -5,8 +5,8 @@ from django_nose.runner import BasicNoseRunner, NoseTestSuiteRunner from django_nose.testcases import FastFixtureTestCase assert BasicNoseRunner +assert NoseTestSuiteRunner assert FastFixtureTestCase VERSION = (1, 4, 3) __version__ = '.'.join(map(str, VERSION)) -run_tests = run_gis_tests = NoseTestSuiteRunner diff --git a/runtests.sh b/runtests.sh index 1c3f144..5dff115 100755 --- a/runtests.sh +++ b/runtests.sh @@ -149,8 +149,8 @@ reset_env django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'normal settings' reset_env -export TEST_RUNNER="django_nose.run_tests" -django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'django_nose.run_tests format' +export TEST_RUNNER="django_nose.NoseTestSuiteRunner" +django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'test runner from environment' reset_env django_test "testapp/runtests.py testapp.test_only_this" 1 'via run_tests API' From 98845552ed13ebc8cd3fcd9384fe2c478ea92485 Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Sun, 26 Jun 2016 22:26:53 -0500 Subject: [PATCH 4/7] Specify Python version for tests Python 3.5 is only available if requested, so Python 3.5 tests were failing. Explicit is better than implicit anyway. --- .travis.yml | 70 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfc354a..2b3590c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,35 +3,57 @@ language: python env: global: - COVERAGE=1 RUNTEST_ARGS="-v --noinput" - matrix: +matrix: + include: # Quality checks - - TOXENV=flake8 - - TOXENV=docs + - env: TOXENV=flake8 + python: "2.7" + - env: TOXENV=docs + python: "2.7" # Supported Python / Django versions w/ SQLite - - TOXENV=py27-django-110 - - TOXENV=py35-django-110 - - TOXENV=py27-django-19 - - TOXENV=py35-django-19 - - TOXENV=py27-django-18 - - TOXENV=py34-django-18 + - env: TOXENV=py27-django-110 + python: "2.7" + - env: TOXENV=py35-django-110 + python: "3.5" + - env: TOXENV=py27-django-19 + python: "2.7" + - env: TOXENV=py35-django-19 + python: "3.5" + - env: TOXENV=py27-django-18 + python: "2.7" + - env: TOXENV=py34-django-18 + python: "3.4" # Test with PostgreSQL - - TOXENV=py27-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-110-postgres" - - TOXENV=py35-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-110-postgres" - - TOXENV=py27-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-19-postgres" - - TOXENV=py35-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-19-postgres" - - TOXENV=py27-django-18-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-18-postgres" + - env: TOXENV=py27-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-110-postgres" + python: "2.7" + - env: TOXENV=py35-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-110-postgres" + python: "3.5" + - env: TOXENV=py27-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-19-postgres" + python: "2.7" + - env: TOXENV=py35-django-19-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-19-postgres" + python: "3.5" + - env: TOXENV=py27-django-18-postgres DATABASE_URL="postgres://postgres@localhost:5432/py27-django-18-postgres" + python: "2.7" # Test with MySQL - - TOXENV=py27-django-110-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-110-mysql" - - TOXENV=py35-django-110-mysql DATABASE_URL="mysql://travis@localhost:3306/py35-django-110-mysql" - - TOXENV=py27-django-19-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-19-mysql" - - TOXENV=py35-django-19-mysql DATABASE_URL="mysql://travis@localhost:3306/py35-django-19-mysql" - - TOXENV=py27-django-18-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-18-mysql" + - env: TOXENV=py27-django-110-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-110-mysql" + python: "2.7" + - env: TOXENV=py35-django-110-mysql DATABASE_URL="mysql://travis@localhost:3306/py35-django-110-mysql" + python: "3.5" + - env: TOXENV=py27-django-19-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-19-mysql" + python: "2.7" + - env: TOXENV=py35-django-19-mysql DATABASE_URL="mysql://travis@localhost:3306/py35-django-19-mysql" + python: "3.5" + - env: TOXENV=py27-django-18-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-18-mysql" + python: "2.7" # Django master is allowed to fail - - TOXENV=py27-django-master - - TOXENV=py35-django-master - - TOXENV=py27-django-master-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-master-mysql" - - TOXENV=py35-django-master-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-master-postgres" -matrix: + - env: TOXENV=py27-django-master + python: "2.7" + - env: TOXENV=py35-django-master + python: "3.5" + - env: TOXENV=py27-django-master-mysql DATABASE_URL="mysql://travis@localhost:3306/py27-django-master-mysql" + python: "2.7" + - env: TOXENV=py35-django-master-postgres DATABASE_URL="postgres://postgres@localhost:5432/py35-django-master-postgres" + python: "3.5" allow_failures: # Master is allowed to fail - env: TOXENV=py27-django-master From 792daf2caf19ddf899557b2d657cbb633738b40d Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Mon, 27 Jun 2016 07:45:38 -0500 Subject: [PATCH 5/7] Fix --nose-verbosity option Both Django and nosetests support --verbosity. There was code to support nose's --verbosity as --nose-verbosity, but it was untested and broken. --- django_nose/runner.py | 12 +++++++----- runtests.sh | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/django_nose/runner.py b/django_nose/runner.py index e4055a8..4fe763f 100644 --- a/django_nose/runner.py +++ b/django_nose/runner.py @@ -149,14 +149,10 @@ def add_arguments(cls, parser): # Process nose optparse options for option in options: - # Skip any options also in Django options + # Gather options opt_long = option.get_opt_string() - if opt_long in django_options: - continue if option._short_opts: opt_short = option._short_opts[0] - if opt_short in django_options: - continue else: opt_short = None @@ -164,6 +160,12 @@ def add_arguments(cls, parser): if opt_long == '--verbosity': opt_long = '--nose-verbosity' + # Skip any options also in Django options + if opt_long in django_options: + continue + if opt_short and opt_short in django_options: + opt_short = None + # Convert optparse attributes to argparse attributes option_attrs = {} for attr in option.ATTRS: diff --git a/runtests.sh b/runtests.sh index 5dff115..da6ee27 100755 --- a/runtests.sh +++ b/runtests.sh @@ -165,6 +165,9 @@ django_test "./manage.py test unittests $NOINPUT" 4 'unittests' reset_env django_test "./manage.py test unittests --verbosity 1 $NOINPUT" 4 'argument option without equals' +reset_env +django_test "./manage.py test unittests --nose-verbosity=2 $NOINPUT" 4 'argument with equals' + reset_env django_test "./manage.py test unittests --testrunner=testapp.custom_runner.CustomNoseTestSuiteRunner $NOINPUT" 4 'unittests with testrunner' From 9f0fdd399c0fd6c592581cd19cfcf8839582c9ae Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Mon, 27 Jun 2016 07:48:33 -0500 Subject: [PATCH 6/7] Update docs for 1.4.4 release --- README.rst | 1 + changelog.rst | 6 ++++++ django_nose/__init__.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index da55ff8..047ab35 100644 --- a/README.rst +++ b/README.rst @@ -48,6 +48,7 @@ recommended. It follows the `Django's support policy`_, supporting: * Django 1.8 (LTS) with Python 2.7, 3.4, or 3.5 * Django 1.9 with Python 2.7, 3.4, or 3.5 + * Django 1.10 with Python 2.7, 3.4, or 3.5 .. _latest release: https://pypi.python.org/pypi/nose .. _Django's support policy: https://docs.djangoproject.com/en/1.8/internals/release-process/#supported-versions diff --git a/changelog.rst b/changelog.rst index 830a14f..1512d4e 100644 --- a/changelog.rst +++ b/changelog.rst @@ -1,6 +1,12 @@ Changelog --------- +1.4.4 (2016-06-27) +~~~~~~~~~~~~~~~~~~ +* Add Django 1.10 support +* Drop Django 1.4, 1.7, and Python 2.6 support +* Drop South support + 1.4.3 (2015-12-28) ~~~~~~~~~~~~~~~~~~ * Add Django 1.9 support diff --git a/django_nose/__init__.py b/django_nose/__init__.py index b7ef098..07d9bcb 100644 --- a/django_nose/__init__.py +++ b/django_nose/__init__.py @@ -8,5 +8,5 @@ assert NoseTestSuiteRunner assert FastFixtureTestCase -VERSION = (1, 4, 3) +VERSION = (1, 4, 4) __version__ = '.'.join(map(str, VERSION)) From d08492e3b59fedb18b955970c7fe05df7a71617a Mon Sep 17 00:00:00 2001 From: John Whitlock Date: Mon, 27 Jun 2016 08:08:43 -0500 Subject: [PATCH 7/7] Drop BaseCommand.option_list support This was using prior to Django 1.8, when management commands used optparse instead of argparse. --- django_nose/runner.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/django_nose/runner.py b/django_nose/runner.py index 4fe763f..14a26f4 100644 --- a/django_nose/runner.py +++ b/django_nose/runner.py @@ -20,7 +20,6 @@ from django.apps import apps from django.conf import settings from django.core import exceptions -from django.core.management.base import BaseCommand from django.core.management.color import no_style from django.core.management.commands.loaddata import Command from django.db import connections, transaction, DEFAULT_DB_ALIAS @@ -273,12 +272,6 @@ def run_tests(self, test_labels, extra_tests=None): if hasattr(settings, 'NOSE_ARGS'): nose_argv.extend(settings.NOSE_ARGS) - # Skip over 'manage.py test' and any arguments handled by django. - django_opts = self.django_opts[:] - for opt in getattr(BaseCommand, 'option_list', []): - django_opts.extend(opt._long_opts) - django_opts.extend(opt._short_opts) - # Recreate the arguments in a nose-compatible format arglist = sys.argv[1:] has_nargs = getattr(self, '_has_nargs', set(['--verbosity'])) @@ -287,7 +280,7 @@ def run_tests(self, test_labels, extra_tests=None): if not opt.startswith('-'): # Discard test labels continue - if any(opt.startswith(d) for d in django_opts): + if any(opt.startswith(d) for d in self.django_opts): # Discard options handled by Djangp continue