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

Outdated django-jenkins don't works with django 1.10 #347

Closed christophlingg closed 7 years ago

christophlingg commented 7 years ago

After upgrading do django 1.10, I got this error. Anything I can do about it?

(venv)jenkins@dev1:~/workspace/my_project$ python3.4 manage.py jenkins
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 208, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 41, in load_command_class
    return module.Command()
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django_jenkins/management/commands/jenkins.py", line 32, in __init__
    for module_name in self.get_task_list()]
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django_jenkins/management/commands/jenkins.py", line 32, in <listcomp>
    for module_name in self.get_task_list()]
AttributeError: 'module' object has no attribute 'Reporter'

The corresponding code fragment:

class Command(TestCommand):
    def __init__(self):
        self.test_runner = None
        self.tasks_cls = [import_module(module_name).Reporter
                          for module_name in self.get_task_list()]
        self.tasks = [task_cls() for task_cls in self.tasks_cls]
        super(Command, self).__init__()
kmmbvnr commented 7 years ago

I don't think that it's related django 1.10 update

What is your JENKINS_TASKS?

Did't you remove with_coverage from it?

christophlingg commented 7 years ago

I removed with_coverage and my setting looks now like this:

JENKINS_TASKS = ()

I just upgraded from 1.8 to 1.10 and this error popped up, so I thought it is related to django's version bump.

Now i get this error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django/apps/config.py", line 116, in create
    mod = import_module(mod_path)
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django_jenkins/apps.py", line 3, in <module>
    from django_jenkins.tasks.with_coverage import CoverageReporter
  File "/data/jenkins/workspace/my_project/venv/lib/python3.4/site-packages/django_jenkins/tasks/with_coverage.py", line 5, in <module>
    from django.utils.importlib import import_module
ImportError: No module named 'django.utils.importlib'

According to stackoverflow django.utils.importlib was removed in django 1.9 in favor of Python's own from importlib import import_module

kmmbvnr commented 7 years ago

If you upgrading django you have to update django-jenkins to the version that has support for the new django version.

This was fixed more than year ago

https://github.com/kmmbvnr/django-jenkins/commit/5bf9afd37381da9cf50347681b34dc39258fa09e

Please carefully read the changelog for each version and update django-jenkins settings according to the instructions.

christophlingg commented 7 years ago

Thanks for your help