CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
792 stars 75 forks source link

Error running Django #80

Closed musicformellons closed 9 years ago

musicformellons commented 9 years ago

I installed it in the virtualenv 'proj' and want to run some django test but get an error:

(proj) usr@usr-XPS:~/proj$ python manage.py test --testrunner=green.djangorunner.DjangoRunner Creating test database for alias 'default'... EEEETraceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/init.py", line 338, in execute_from_command_line utility.execute() File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/init.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv super(Command, self).run_from_argv(argv) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/base.py", line 393, in run_from_argv self.execute(_args, _cmd_options) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/commands/test.py", line 74, in execute super(Command, self).execute(_args, _options) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/base.py", line 444, in execute output = self.handle(_args, *_options) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/django/core/management/commands/test.py", line 90, in handle failures = test_runner.run_tests(test_labels) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/green/djangorunner.py", line 105, in run_tests result = run(suite, stream, args) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/green/runner.py", line 118, in run result.addProtoTestResult(proto_test_result) File "/home/usr/.pyenv/versions/proj/lib/python3.4/site-packages/green/result.py", line 337, in addProtoTestResult for test, err in proto_test_result.errors: AttributeError: 'ProtoTest' object has no attribute 'errors'

CleanCut commented 9 years ago

What version of Django are you using? What operating system are you on?

Is your project open source? If so, where's the repo for it? If not, could you provide a minimal example so I can reproduce the problem?

musicformellons commented 9 years ago

Django 1.8.4 with Ubuntu Gnome 15.04 Using pyenv-virtualenv for virtual environment: https://github.com/yyuu/pyenv-virtualenv I am working on Cookie Cutter Django: https://github.com/pydanny/cookiecutter-django

further info: ~$ pip freeze alabaster==0.7.6 Babel==2.0 binaryornot==0.4.0 chardet==2.3.0 click==3.3 colorama==0.3.3 cookiecutter==1.0.0 coverage==4.0b2 decorator==4.0.2 defusedxml==0.4.1 Django==1.8.4 django-allauth==0.23.0 django-autoslug==1.8.0 django-braces==1.8.1 django-crispy-forms==1.5.1 django-debug-toolbar==1.3.2 django-environ==0.3.0 django-extensions==1.5.6 django-flat-theme==1.1.0 django-floppyforms==1.5.2 django-model-utils==2.3.1 django-redis==4.2.0 django-secure==1.0.1 django-test-plus==1.0.9 docutils==0.12 factory-boy==2.5.2 flake8==2.4.1 green==2.0.4 ipdb==0.8.1 ipython==4.0.0 ipython-genutils==0.1.0 Jinja2==2.8 MarkupSafe==0.23 mccabe==0.3.1 mock==1.3.0 msgpack-python==0.4.6 oauthlib==1.0.3 path.py==8.1 pbr==1.6.0 pep8==1.5.7 pexpect==3.3 pickleshare==0.5 Pillow==2.9.0 psycopg2==2.6.1 pyflakes==0.8.1 Pygments==2.0.2 python-termstyle==0.1.10 python3-openid==3.0.6 pytz==2015.4 PyYAML==3.11 redis==2.10.3 requests==2.7.0 requests-oauthlib==0.5.0 simplegeneric==0.8.1 six==1.9.0 snowballstemmer==1.2.0 Sphinx==1.3.1 sphinx-rtd-theme==0.1.8 sqlparse==0.1.16 traitlets==4.0.0 unicode-slugify==0.1.3 Unidecode==0.4.18 Werkzeug==0.10.4 whitenoise==2.0.3

CleanCut commented 9 years ago

Sorry this took me so long to get to. I have been swamped.

The root of the problem is that your project has {{cookiecutter.reponame}} as the name of your python package directory, which is not a valid name. See https://www.python.org/dev/peps/pep-0008/#package-and-module-names

I was able to fix green to avoid trying to import packages with invalid names so that green itself no longer crashes. Instead you get test failures, which is actually useful. The fix will be in the next release.

CleanCut commented 9 years ago

Fix will be in 2.0.5