程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Update to Django 1.8 - AttributeError: django. test. TestCase has no attribute cls_ atomics

編輯:Python

problem :

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 ). I will Django 1.7 The project is updated to Django 1.8, Error running test now ( This is a django.test.TestCase Subclass ).

Traceback (most recent call last): File "env\lib\site-packages\django\test\testcases.py", line 962, in tearDownClasscls._rollback_atomics(cls.cls_atomics) AttributeError: type object 'SomeTests' has no attribute 'cls_atomics'

If I debug through the test I can step through all lines without problems, but after the last line the exception is thrown. If I debug by testing , I can traverse all the rows without any problem , But throw an exception after the last line .

This is an example test: This is an example test :

import djangoimport unittestfrom django.test import TestCaseimport loggingimport sysfrom builtins import classmethod, isinstanceclass ATestTests(TestCase): @classmethod def setUpClass(cls): django.setup() logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) def setUp(self): self._app = Application(name="a") def testtest(self): self.assertIsNotNone(self._app)

My environment: My environment :

astroid==1.3.4colorama==0.3.3defusedxml==0.4.1Django==1.8django-extensions==1.5.2django-filter==0.9.2djangorestframework==3.0.5djangorestframework-xml==1.0.1eight==0.3.0future==0.11.4logilab-common==0.63.2Markdown==2.5.2pylint==1.4.1python-dateutil==2.4.1python-mimeparse==0.1.4six==1.9.0xmltodict==0.9.2

How can I fix this? How can I solve this problem ?


Solution :

Reference resources : https://stackoom.com/en/question/20Q8H

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved