Running tests with coverage using django-jenkins
Question: I've got a couple of Django projects that I work on, and I use Jenkins for
continuous integration purposes. I've had that arrangement up and running for
a while and it works well.

I'd like to be able to generate automated test coverage reports and have
Jenkins handle them as well. It looked to me like [django-
jenkins](https://github.com/kmmbvnr/django-jenkins) was the way to go for
that, so I installed it and `coverage`.

Here's the relevant sections of my `settings.py`:

    
    
    # Jenkins integration
    INSTALLED_APPS += ('django_jenkins',)
    JENKINS_TASKS = ( 
        'django_jenkins.tasks.with_coverage',
        'django_jenkins.tasks.run_pylint',
        'django_jenkins.tasks.django_tests',
    )
    PROJECT_APPS = ['myapp']
    

Now, I can run `python manage.py jtest`, and it works as expected. However, if
I run `python manage.py jenkins`, it errors:

    
    
    Traceback (most recent call last):
      File "manage.py", line 10, in <module>
        execute_from_command_line(sys.argv)
      File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
        utility.execute()
      File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
        klass = load_command_class(app_name, subcommand)
      File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 76, in load_command_class
        return module.Command()
      File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django_jenkins/management/commands/__init__.py", line 61, in __init__
        for module_name in self.get_task_list()]
      File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
        __import__(name)
    ImportError: No module named django_tests
    

I'm using the standard Django `TestCase` and `LiveServerTestCase` classes as
the basis of my tests. Any idea where I'm going wrong here? The documentation
seems to imply `django_tests` has been removed, but I can't find any
indication as to how you run the Django tests now.

I'm using Django 1.6.2.


Answer: Just realised I've been a bit of a numpty. All I needed to do was drop the
`django_tests` line, like this:

    
    
    # Jenkins integration
    INSTALLED_APPS += ('django_jenkins',)
    JENKINS_TASKS = ( 
        'django_jenkins.tasks.with_coverage',
        'django_jenkins.tasks.run_pylint',
    )
    PROJECT_APPS = ['myapp']
    

And `django-jenkins` will run the tests without having to explicitly request
that it does so.

