首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Django-lean测试失败,用户在两个/两个组中

Django-lean测试失败,用户在两个/两个组中
EN

Stack Overflow用户
提问于 2013-01-28 20:37:57
回答 1查看 40关注 0票数 1

我在试用django-lean时,发现有一些奇怪的行为,有时会显示测试或控件,但有时两者都不会显示(对于同一个请求)。

我用./manage.py test experimets运行测试,有两个测试失败:

代码语言:javascript
复制
======================================================================
FAIL: testIntegrationWithAnonymousVisitor (experiments.tests.test_tags.ExperimentTagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 35, in testIntegrationWithAnonymousVisitor
    client_factory=lambda i: Client())
  File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 76, in doTestIntegration
    self.assertTrue(in_test != in_control)
AssertionError: False is not true

======================================================================
FAIL: testIntegrationWithRegisteredUser (experiments.tests.test_tags.ExperimentTagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 55, in testIntegrationWithRegisteredUser
    client_factory=create_registered_user_client)
  File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 76, in doTestIntegration
    self.assertTrue(in_test != in_control)
AssertionError: False is not true

这里到底发生了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-27 04:22:31

我自己也遇到了同样的问题..解决方案就在文档中:

确保django.core.context_processors.request在settings.py中的TEMPLATE_CONTEXT_PROCESSORS

这应该在您的settings.py

代码语言:javascript
复制
TEMPLATE_CONTEXT_PROCESSORS = (
      "django.contrib.auth.context_processors.auth",
      "django.core.context_processors.debug",
      "django.core.context_processors.i18n",
      "django.core.context_processors.media",
      "django.core.context_processors.static",
      "django.core.context_processors.tz",
      "django.contrib.messages.context_processors.messages",
      "django.core.context_processors.request",
  )
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14562220

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档