Skip to content

Commit

Permalink
Fix --nose-verbosity option
Browse files Browse the repository at this point in the history
Both Django and nosetests support --verbosity. There was code to support
nose's --verbosity as --nose-verbosity, but it was untested and broken.
  • Loading branch information
jwhitlock committed Jun 27, 2016
1 parent 9884555 commit 792daf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 7 additions & 5 deletions django_nose/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,23 @@ 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

# Rename nose's --verbosity to --nose-verbosity
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:
Expand Down
3 changes: 3 additions & 0 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit 792daf2

Please sign in to comment.