jazzband / django-nose

Django test runner using nose
http://pypi.python.org/pypi/django-nose
BSD 3-Clause "New" or "Revised" License
882 stars 239 forks source link

Option --no-color conflicting option string(s): --no-color #156

Open davidfischer-ch opened 10 years ago

davidfischer-ch commented 10 years ago

Tested with Django from GitHub commit 20da67d325190ec131ae5da2ae415335ecbeae24

$ ./manage.py test

/usr/local/lib/python2.7/dist-packages/django/test/_doctest.py:57: DeprecationWarning: The django.test._doctest module is deprecated; use the doctest module from the Python standard library instead.
  DeprecationWarning)

/usr/local/lib/python2.7/dist-packages/django/test/simple.py:26: DeprecationWarning: The django.test.simple module and DjangoTestSuiteRunner are deprecated; use django.test.runner.DiscoverRunner instead.
  DeprecationWarning)

Creating test database for alias 'default'...

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
Destroying test database for alias 'default'...
david@GaViD:~/prog/cloudncode/cloudncode$ ./manage.py test
/usr/local/lib/python2.7/dist-packages/django/test/_doctest.py:57: DeprecationWarning: The django.test._doctest module is deprecated; use the doctest module from the Python standard library instead.
  DeprecationWarning)

/usr/local/lib/python2.7/dist-packages/django/test/simple.py:26: DeprecationWarning: The django.test.simple module and DjangoTestSuiteRunner are deprecated; use django.test.runner.DiscoverRunner instead.
  DeprecationWarning)

Traceback (most recent call last):
  File "./manage.py", line 27, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 427, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 419, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 283, in run_from_argv
    parser = self.create_parser(argv[0], argv[1])
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 59, in create_parser
    option_list=options)
  File "/usr/lib/python2.7/optparse.py", line 1219, in __init__
    add_help=add_help_option)
  File "/usr/lib/python2.7/optparse.py", line 1261, in _populate_option_list
    self.add_options(option_list)
  File "/usr/lib/python2.7/optparse.py", line 1039, in add_options
    self.add_option(option)
  File "/usr/lib/python2.7/optparse.py", line 1020, in add_option
    self._check_conflict(option)
  File "/usr/lib/python2.7/optparse.py", line 995, in _check_conflict
    option)
optparse.OptionConflictError: option --no-color: conflicting option string(s): --no-color

Packages:

$ pip freeze | grep 'django\|nose'
django-admin-bootstrapped==1.6.4
django-appconf==0.6
django-bootstrap-toolkit==2.15.0
django-braces==1.3.1
django-celery==3.1.9
django-ckeditor==4.0.2
django-classy-tags==0.5
django-compressor==1.4a1
django-coverage==1.2.4
django-crispy-extensions==0.1.0
django-crispy-forms==1.5.0
django-debug-toolbar==1.0.1
django-email-obfuscator==0.1.2
django-extensions==1.3.3
django-extra-views==0.6.4
django-floppyforms==1.1
django-imagefit==0.4
django-multilingualfield==0.2
django-nose==1.2
django-pagination==1.0.7
django-qrcode==0.3
django-sendfile==0.3.4
django-staticfiles-bootstrap==3.0.0
django-staticfiles-jquery==1.8.3
django-suit==0.2.6
django-template-minifier==1.0
django-thumbs==0.4
django-tinymce==1.5.1
django-wysiwyg==0.6.0
nose==1.3.0
rednose==0.3.3
xdiagnose==3.6.1
svfat commented 10 years ago

I have same issue too, this is a conflict with celery. Quick dirty hack to fix it is commenting "Option('--no-color', '-C', action='store_true', default=None)," in site-packages/celery/bin/base.py

arthuralvim commented 10 years ago

Well, it may be just like @svfat said but I believe it has something to do with the rednose plugin which also has an option --no-color. Django 1.7 seems to have a new test option --no-color (check in python manage.py help test). What version of Django do you have installed? django-nose merge all options from all plugins, and that's when the conflict occurs. It had occurred in past release such as Django 1.6 with the -p option. Look issue #123 .

arthuralvim commented 10 years ago

The part when the options clashes seems to be in /django_nose/management/commands/test.py line 33.

class Command(Command):
    option_list = Command.option_list + tuple(extra_options)

The extra_options variable comes with the options from the plugins.

areski commented 10 years ago

@arthuralvim do you know if there is a PR for this fix?

crucialfelix commented 9 years ago

I can confirm: the conflict is with rednose

jwhitlock commented 9 years ago

Can someone confirm if this is still broken with nose 1.4? Please report Django version as well - the argument parsing changes from Django 1.7 to 1.8.

andreinl commented 9 years ago

I can confirm that the problem still exists with nose 1.4.1 and Django 1.7.7.

Uninstalling rednose solved the problem

jwhitlock commented 9 years ago

@lanart - thanks. I think we have a few command line parsing issues to roll into v1.4.2

jwhitlock commented 9 years ago

I started to dive into command line parsing, and it will require bigger changes than expected. Still doable, but not for v1.4.2.

jwhitlock commented 8 years ago

I'm postponing fixing this issue again. It has a different cause than the other command line parsing issues, and v1.4.3 is otherwise ready for release.

jwhitlock commented 8 years ago

I'm unable to duplicate this in current code. I installed rednose, enabled it with export NOSE_REDNOSE=1, and ran ../manage.py test. I got colored output. With ./manage.py test --no-color, the color is removed. I believe the fix is in django-nose 1.4, when running against Django 1.8 or later. Django 1.7 or earlier would still be broken.

I also run celery in another project, and haven't encountered an error.

Can someone hitting this issue please try it again? @andreinl ?