Update to Django 1.8 - AttributeError: django.test.TestCase has no attribute 'cls_atomics'

后端 未结 4 1274
既然无缘
既然无缘 2021-02-11 11:41

I updated a Django 1.7 project to Django 1.8 and now get errors when I run the tests (that are subclasses of django.test.TestCase).

Traceback (most          


        
4条回答
  •  无人及你
    2021-02-11 12:38

    I believe the reason is that your setUpClass(cls) class method is not calling super. Because of that, django.tests.TestCase.setUpClass is not called and

    cls.cls_atomics = cls._enter_atomics()
    

    is not called, naturally causing cls_atomics to be undefined.

    You should add super(ATestTests, cls).setUpClass() to your setUpClass.

提交回复
热议问题