kmmbvnr / django-jenkins

Plug and play continuous integration with django and jenkins
GNU Lesser General Public License v3.0
945 stars 279 forks source link

problem with coverage.save #328

Closed vpoulailleau closed 8 years ago

vpoulailleau commented 8 years ago

I haven't searched yet why coverage = apps.get_app_config('django_jenkins').coverage returns None in my case (jenkins.py:154)

But this creates a bug, in the same file just after:

            coverage = apps.get_app_config('django_jenkins').coverage
            if coverage:
                if options['verbosity'] >= 1:
                    print('Storing coverage info...')

            coverage.save(tested_locations, options)

It tells me:

    super(Command, self).execute(*args, **options)
  File "/var/lib/jenkins/.virtualenvs/guesthouse/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/var/lib/jenkins/.virtualenvs/guesthouse/lib/python3.4/site-packages/django_jenkins/management/commands/jenkins.py", line 159, in handle
    coverage.save(tested_locations, options)
AttributeError: 'NoneType' object has no attribute 'save'

I will try to see why the first call returns None. But the line 159 should be placed in if coverage:

Best regards, Vincent

vpoulailleau commented 8 years ago

The problem occurred because I missed the --enable-coverage flag.

kmmbvnr commented 8 years ago

already fixed https://github.com/kmmbvnr/django-jenkins/blob/master/django_jenkins/management/commands/jenkins.py#L154