[Python-modules-commits] [django-nose] 01/10: Import django-nose_1.4.3.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Thu Jan 7 13:03:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository django-nose.

commit d418be775674518b1226ef5039f7f36ec4b8d84d
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Thu Jan 7 12:50:54 2016 +0100

    Import django-nose_1.4.3.orig.tar.gz
---
 AUTHORS.rst                             |  3 ++
 README.rst                              |  2 +-
 changelog.rst                           | 11 ++++
 django_nose/__init__.py                 |  2 +-
 django_nose/management/commands/test.py |  1 -
 django_nose/plugin.py                   |  5 --
 django_nose/runner.py                   | 93 +++++++++++++++++++++++++--------
 django_nose/testcases.py                |  1 -
 django_nose/tools.py                    |  1 -
 requirements.txt                        |  4 +-
 runtests.sh                             |  6 +++
 setup.cfg                               |  2 +-
 setup.py                                |  4 +-
 testapp/custom_runner.py                |  1 -
 testapp/models.py                       |  2 -
 testapp/plugins.py                      |  1 -
 testapp/tests.py                        |  3 --
 tox.ini                                 |  9 ++--
 unittests/test_databases.py             |  3 +-
 19 files changed, 105 insertions(+), 49 deletions(-)

diff --git a/AUTHORS.rst b/AUTHORS.rst
index 4b0e627..635c195 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -38,6 +38,7 @@ These non-maintainers have contributed code to a django-nose release:
 * Fred Wenzel (`fwenzel <https://github.com/fwenzel>`_)
 * Fábio Santos (`fabiosantoscode <https://github.com/fabiosantoscode>`_)
 * Ionel Cristian Mărieș (`ionelmc <https://github.com/ionelmc>`_)
+* Jeremy Satterfield (`jsatt <https://github.com/jsatt>`_)
 * Johan Euphrosine (`proppy <https://github.com/proppy>`_)
 * Kyle Robertson (`dvelyk <https://github.com/dvelyk>`_)
 * Marius Gedminas (`mgedmin <https://github.com/mgedmin>`_)
@@ -55,4 +56,6 @@ These non-maintainers have contributed code to a django-nose release:
 * Stephen Burrows (`melinath <https://github.com/melinath>`_)
 * Sverre Johansen (`sverrejoh <https://github.com/sverrejoh>`_)
 * Tim Child (`timc3 <https://github.com/timc3>`_)
+* Walter Doekes (`wdoekes <https://github.com/wdoekes>`_)
+* Will Kahn-Greene (`willkg <https://github.com/willkg>`_)
 * Yegor Roganov (`roganov <https://github.com/roganov>`_)
diff --git a/README.rst b/README.rst
index 3b737d2..3429de8 100644
--- a/README.rst
+++ b/README.rst
@@ -49,7 +49,7 @@ recommended.  It follows the `Django's support policy`_, supporting:
   * Django 1.4 (LTS) with Python 2.6 and 2.7
   * Django 1.7 with Python 2.7 or 3.4
   * Django 1.8 (LTS) with Python 2.7 or 3.4
-  * Django 1.9 (pre-release)
+  * Django 1.9 with Python 2.7 or 3.4
 
 .. _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 b9fea48..830a14f 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -1,6 +1,17 @@
 Changelog
 ---------
 
+1.4.3 (2015-12-28)
+~~~~~~~~~~~~~~~~~~
+* Add Django 1.9 support
+* Support long options without equals signs, such as "--attr selected"
+* Support nose plugins using callback options
+* Support nose options without default values (jsatt)
+* Remove Django from install dependencies, to avoid accidental upgrades
+  (jsocol, willkg)
+* Setting REUSE_DB to an empty value now disables REUSE_DB, instead of
+  enabling it (wdoekes)
+
 1.4.2 (2015-10-07)
 ~~~~~~~~~~~~~~~~~~
 * Warn against using REUSE_DB=1 and FastFixtureTestCase in docs
diff --git a/django_nose/__init__.py b/django_nose/__init__.py
index 3b8be08..d18f29c 100644
--- a/django_nose/__init__.py
+++ b/django_nose/__init__.py
@@ -7,7 +7,7 @@ from django_nose.testcases import FastFixtureTestCase
 assert BasicNoseRunner
 assert FastFixtureTestCase
 
-VERSION = (1, 4, 2)
+VERSION = (1, 4, 3)
 __version__ = '.'.join(map(str, VERSION))
 
 # Django < 1.2 compatibility.
diff --git a/django_nose/management/commands/test.py b/django_nose/management/commands/test.py
index 81505e4..1c29160 100644
--- a/django_nose/management/commands/test.py
+++ b/django_nose/management/commands/test.py
@@ -34,7 +34,6 @@ else:
 
 
 class Command(Command):
-
     """Implement the ``test`` command."""
 
     option_list = Command.option_list + tuple(extra_options)
diff --git a/django_nose/plugin.py b/django_nose/plugin.py
index 2e5e409..b164378 100644
--- a/django_nose/plugin.py
+++ b/django_nose/plugin.py
@@ -14,7 +14,6 @@ from django_nose.utils import process_tests, is_subclass_at_all
 
 
 class AlwaysOnPlugin(Plugin):
-
     """A base plugin that takes no options and is always enabled."""
 
     def options(self, parser, env):
@@ -32,7 +31,6 @@ class AlwaysOnPlugin(Plugin):
 
 
 class ResultPlugin(AlwaysOnPlugin):
-
     """Captures the TestResult object for later inspection.
 
     nose doesn't return the full test result object from any of its runner
@@ -48,7 +46,6 @@ class ResultPlugin(AlwaysOnPlugin):
 
 
 class DjangoSetUpPlugin(AlwaysOnPlugin):
-
     """Configures Django to set up and tear down the environment.
 
     This allows coverage to report on all code imported and used during the
@@ -93,7 +90,6 @@ class DjangoSetUpPlugin(AlwaysOnPlugin):
 
 
 class Bucketer(object):
-
     """Collect tests into buckets with similar setup requirements."""
 
     def __init__(self):
@@ -125,7 +121,6 @@ class Bucketer(object):
 
 
 class TestReorderer(AlwaysOnPlugin):
-
     """Reorder tests for various reasons."""
 
     name = 'django-nose-test-reorderer'
diff --git a/django_nose/runner.py b/django_nose/runner.py
index e624db2..485a9f4 100644
--- a/django_nose/runner.py
+++ b/django_nose/runner.py
@@ -11,7 +11,7 @@ in settings.py for arguments that you want always passed to nose.
 from __future__ import print_function, unicode_literals
 import os
 import sys
-from optparse import make_option
+from optparse import make_option, NO_DEFAULT
 from types import MethodType
 
 import django
@@ -153,7 +153,12 @@ if hasattr(BaseCommand, 'use_argparse'):
         # Don't pass the following options to nosetests
         django_opts = [
             '--noinput', '--liveserver', '-p', '--pattern', '--testrunner',
-            '--settings']
+            '--settings',
+            # 1.8 arguments
+            '--keepdb', '--reverse', '--debug-sql',
+            # 1.9 arguments
+            '--parallel',
+        ]
 
         #
         # For optparse -> argparse conversion
@@ -176,15 +181,17 @@ if hasattr(BaseCommand, 'use_argparse'):
         # If optparse has a None argument, omit from call to add_argument
         _argparse_omit_if_none = (
             'action', 'nargs', 'const', 'default', 'type', 'choices',
-            'required', 'help', 'metavar', 'dest', 'callback', 'callback_args',
-            'callback_kwargs')
+            'required', 'help', 'metavar', 'dest')
 
-        # Translating callbacks is not supported, because none of the built-in
-        # plugins uses one.  If you have a plugin that uses a callback, please
-        # open a ticket or submit a working implementation.
-        _argparse_fail_if_not_none = (
+        # Always ignore these optparse arguments
+        # Django will parse without calling the callback
+        # nose will then reparse with the callback
+        _argparse_callback_options = (
             'callback', 'callback_args', 'callback_kwargs')
 
+        # Keep track of nose options with nargs=1
+        _has_nargs = set(['--verbosity'])
+
         @classmethod
         def add_arguments(cls, parser):
             """Convert nose's optparse arguments to argparse."""
@@ -228,8 +235,15 @@ if hasattr(BaseCommand, 'use_argparse'):
                 # Convert optparse attributes to argparse attributes
                 option_attrs = {}
                 for attr in option.ATTRS:
+                    # Ignore callback options
+                    if attr in cls._argparse_callback_options:
+                        continue
+
                     value = getattr(option, attr)
 
+                    if attr == 'default' and value == NO_DEFAULT:
+                        continue
+
                     # Rename options for nose's --verbosity
                     if opt_long == '--nose-verbosity':
                         if attr == 'dest':
@@ -241,17 +255,23 @@ if hasattr(BaseCommand, 'use_argparse'):
                     if attr in cls._argparse_omit_if_none and value is None:
                         continue
 
-                    # Translating callbacks is not supported
-                    if attr in cls._argparse_fail_if_not_none:
-                        assert value is None, (
-                            'argparse option %s=%s is not supported' %
-                            (attr, value))
-                        continue
-
                     # Convert type from optparse string to argparse type
                     if attr == 'type':
                         value = cls._argparse_type[value]
 
+                    # Convert action='callback' to action='store'
+                    if attr == 'action' and value == 'callback':
+                        action = 'store'
+
+                    # Keep track of nargs=1
+                    if attr == 'nargs':
+                        assert value == 1, (
+                            'argparse option nargs=%s is not supported' %
+                            value)
+                        cls._has_nargs.add(opt_long)
+                        if opt_short:
+                            cls._has_nargs.add(opt_short)
+
                     # Pass converted attribute to optparse option
                     option_attrs[attr] = value
 
@@ -270,9 +290,22 @@ else:
         django_opts = [
             '--noinput', '--liveserver', '-p', '--pattern', '--testrunner']
 
+        # Default nosetest options with an argument
+        _has_nargs = set([
+            '--attr', '--config', '--cover-html-dir', '--cover-min-percentage',
+            '--cover-package', '--cover-xml-file', '--debug', '--debug-log',
+            '--doctest-extension', '--doctest-fixtures', '--doctest-options',
+            '--doctest-result-variable', '--eval-attr', '--exclude',
+            '--id-file', '--ignore-files', '--include', '--logging-config',
+            '--logging-datefmt', '--logging-filter', '--logging-format',
+            '--logging-level', '--match', '--process-timeout', '--processes',
+            '--profile-restrict', '--profile-sort', '--profile-stats-file',
+            '--py3where', '--tests', u'--verbosity', '--where', '--xunit-file',
+            '--xunit-testsuite-name', '-A', '-I', '-a', '-c', '-e', '-i', '-l',
+            '-m', '-w'])
 
-class BasicNoseRunner(BaseRunner):
 
+class BasicNoseRunner(BaseRunner):
     """Facade that implements a nose runner in the guise of a Django runner.
 
     You shouldn't have to use this directly unless the additions made by
@@ -339,10 +372,25 @@ class BasicNoseRunner(BaseRunner):
             django_opts.extend(opt._long_opts)
             django_opts.extend(opt._short_opts)
 
-        nose_argv.extend(
-            translate_option(opt) for opt in sys.argv[1:]
-            if opt.startswith('-') and
-            not any(opt.startswith(d) for d in django_opts))
+        # Recreate the arguments in a nose-compatible format
+        arglist = sys.argv[1:]
+        has_nargs = getattr(self, '_has_nargs', set(['--verbosity']))
+        while arglist:
+            opt = arglist.pop(0)
+            if not opt.startswith('-'):
+                # Discard test labels
+                continue
+            if any(opt.startswith(d) for d in django_opts):
+                # Discard options handled by Djangp
+                continue
+
+            trans_opt = translate_option(opt)
+            nose_argv.append(trans_opt)
+
+            if opt in has_nargs:
+                # Handle arguments without an equals sign
+                opt_value = arglist.pop(0)
+                nose_argv.append(opt_value)
 
         # if --nose-verbosity was omitted, pass Django verbosity to nose
         if ('--verbosity' not in nose_argv and
@@ -411,7 +459,7 @@ def _skip_create_test_db(self, verbosity=1, autoclobber=False, serialize=True,
 
 def _reusing_db():
     """Return whether the ``REUSE_DB`` flag was passed."""
-    return os.getenv('REUSE_DB', 'false').lower() in ('true', '1', '')
+    return os.getenv('REUSE_DB', 'false').lower() in ('true', '1')
 
 
 def _can_support_reuse_db(connection):
@@ -467,14 +515,13 @@ def _mysql_reset_sequences(style, connection):
 
 
 class NoseTestSuiteRunner(BasicNoseRunner):
-
     """A runner that optionally skips DB creation.
 
     Monkeypatches connection.creation to let you skip creating databases if
     they already exist. Your tests will start up much faster.
 
     To opt into this behavior, set the environment variable ``REUSE_DB`` to
-    something that isn't "0" or "false" (case insensitive).
+    "1" or "true" (case insensitive).
     """
 
     def _get_models_for_connection(self, connection):
diff --git a/django_nose/testcases.py b/django_nose/testcases.py
index 09c16f1..836a7d6 100644
--- a/django_nose/testcases.py
+++ b/django_nose/testcases.py
@@ -16,7 +16,6 @@ __all__ = ('FastFixtureTestCase', )
 
 
 class FastFixtureTestCase(test.TransactionTestCase):
-
     """Test case that loads fixtures once rather than once per test.
 
     Using this can save huge swaths of time while still preserving test
diff --git a/django_nose/tools.py b/django_nose/tools.py
index b6eb187..4469691 100644
--- a/django_nose/tools.py
+++ b/django_nose/tools.py
@@ -37,7 +37,6 @@ def _get_django_vars():
         return str(camelcase.sub(insert_underscore, name).lower())
 
     class Dummy(TransactionTestCase):
-
         """A dummy test case for gathering current assertion helpers."""
 
         def nop():
diff --git a/requirements.txt b/requirements.txt
index 5cec25d..fa345d8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -18,8 +18,8 @@ wheel==0.26.0
 mccabe==0.3.1
 pep8==1.6.2
 pyflakes==1.0.0
-flake8==2.4.1
-pep257==0.6.0
+flake8==2.5.0
+pep257==0.7.0
 flake8-docstrings==0.2.1
 
 # Code coverage
diff --git a/runtests.sh b/runtests.sh
index 38a01f0..f825e3a 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -172,9 +172,15 @@ reset_env
 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 --testrunner=testapp.custom_runner.CustomNoseTestSuiteRunner $NOINPUT" 4 'unittests with testrunner'
 
 reset_env
+django_test "./manage.py test unittests --attr special $NOINPUT" 1 'select by attribute'
+
+reset_env
 export REUSE_DB=1
 # For the many issues with REUSE_DB=1, see:
 # https://github.com/django-nose/django-nose/milestones/Fix%20REUSE_DB=1
diff --git a/setup.cfg b/setup.cfg
index 508e6be..b9640ea 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -13,7 +13,7 @@ omit =
     testapp/migrations/*.py
 
 [flake8]
-exclude = ./.tox/
+exclude = .tox/*,build/*
 
 [wheel]
 universal = 1
diff --git a/setup.py b/setup.py
index e62589b..2b9f8fc 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@ _(Older changes can be found in the full documentation)._
 
 setup(
     name='django-nose',
-    version='1.4.2',
+    version='1.4.3',
     description='Makes your Django tests simple and snappy',
     long_description=get_long_description('django-nose'),
     author='Jeff Balogh',
@@ -48,7 +48,7 @@ setup(
     packages=find_packages(exclude=['testapp', 'testapp/*']),
     include_package_data=True,
     zip_safe=False,
-    install_requires=['nose>=1.2.1', 'Django>=1.4'],
+    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,
diff --git a/testapp/custom_runner.py b/testapp/custom_runner.py
index 547a1b1..63b4b38 100644
--- a/testapp/custom_runner.py
+++ b/testapp/custom_runner.py
@@ -3,5 +3,4 @@ from django_nose import NoseTestSuiteRunner
 
 
 class CustomNoseTestSuiteRunner(NoseTestSuiteRunner):
-
     """Custom test runner, to test overring runner."""
diff --git a/testapp/models.py b/testapp/models.py
index 5edd6e3..f4b398e 100644
--- a/testapp/models.py
+++ b/testapp/models.py
@@ -8,7 +8,6 @@ from django.db import models
 
 
 class Question(models.Model):
-
     """A poll question."""
 
     question_text = models.CharField(max_length=200)
@@ -20,7 +19,6 @@ class Question(models.Model):
 
 
 class Choice(models.Model):
-
     """A poll answer."""
 
     question = models.ForeignKey(Question)
diff --git a/testapp/plugins.py b/testapp/plugins.py
index d2e83aa..9667ad7 100644
--- a/testapp/plugins.py
+++ b/testapp/plugins.py
@@ -5,7 +5,6 @@ plugin_began = False
 
 
 class SanityCheckPlugin(Plugin):
-
     """Test plugin that registers that it ran."""
 
     enabled = True
diff --git a/testapp/tests.py b/testapp/tests.py
index c4950ba..4a2522f 100644
--- a/testapp/tests.py
+++ b/testapp/tests.py
@@ -7,7 +7,6 @@ from testapp.models import Question, Choice
 
 
 class NoDatabaseTestCase(TestCase):
-
     """Tests that don't read or write to the database."""
 
     def test_question_str(self):
@@ -22,7 +21,6 @@ class NoDatabaseTestCase(TestCase):
 
 
 class UsesDatabaseTestCase(TestCase):
-
     """Tests that read and write to the database."""
 
     def test_question(self):
@@ -37,7 +35,6 @@ class UsesDatabaseTestCase(TestCase):
 
 
 class UsesFixtureTestCase(TestCase):
-
     """Tests that use a test fixture."""
 
     fixtures = ["testdata.json"]
diff --git a/tox.ini b/tox.ini
index 2379926..25ecd8f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -19,15 +19,17 @@ deps =
     django-14: South
     django-17: Django>=1.7,<1.8
     django-18: Django>=1.8,<1.9
-    django-19: Django==1.9a1
+    django-19: Django==1.9,<1.10
     django-master: https://github.com/django/django/archive/master.tar.gz
     {py26,py27,py34,py35}-django-{14,17,18,19,master}-postgres: psycopg2
     {py26,py27,py34,py35}-django-{14,17,18,19,master}-mysql: mysqlclient
 
 [testenv:flake8]
 deps =
-    Django>=1.8,<1.9
-    flake8==2.4.1
+    Django>=1.9,<1.10
+    pep257==0.7.0
+    pep8==1.6.2
+    flake8==2.5.0
     flake8-docstrings==0.2.1
 commands = flake8
 
@@ -36,4 +38,5 @@ changedir = docs
 deps =
     Sphinx
     dj-database-url
+    Django
 commands = sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
diff --git a/unittests/test_databases.py b/unittests/test_databases.py
index 1371b29..a3f5268 100644
--- a/unittests/test_databases.py
+++ b/unittests/test_databases.py
@@ -7,11 +7,11 @@ try:
 except:
     from django.apps import apps
 
+from nose.plugins.attrib import attr
 from django_nose.runner import NoseTestSuiteRunner
 
 
 class GetModelsForConnectionTests(TestCase):
-
     """Test runner._get_models_for_connection."""
 
     tables = ['test_table%d' % i for i in range(5)]
@@ -63,6 +63,7 @@ class GetModelsForConnectionTests(TestCase):
             self.assertEqual(
                 self.runner._get_models_for_connection(connection), [])
 
+    @attr("special")
     def test_some_models(self):
         """If some of the models are in the DB, return matching models."""
         connection = self._connection_mock(self.tables)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-nose.git



More information about the Python-modules-commits mailing list