代码之家  ›  专栏  ›  技术社区  ›  Dmitry Gladkov

django nose testrunner不使用--with django选项

  •  2
  • Dmitry Gladkov  · 技术社区  · 15 年前

    --with-django 选择 nosetests ,因此我的nose+Twill测试在尝试访问URL时失败:

    ./manage.py test
    ...
    raise BrowserStateError("cannot go to '%s'" % (url,))
    BrowserStateError: cannot go to 'http://127.0.0.1:8088/admin/'
    ----------------------------------------------------------------------
    Ran 2 tests in 0.166s
    
    FAILED (errors=1)
    

    当我提供 手动或设置 NOSE_WITH_DJANGO=1

    $ ./manage.py test --with-django
    ...
    Ran 2 tests in 0.199s
    
    OK
    ...
    AttributeError: type object 'Template' has no attribute 'original_render'
    

    nosetests --with-django 成功运行测试

    1 回复  |  直到 15 年前
        1
  •  0
  •   Dmitry Gladkov    15 年前

    原来问题是我用了 tddspry django-nose

    TDD撬 来自官方 git repository ,最新稳定 django鼻 from PyPI

    TEST_RUNNER = 'tddspry.django.runner.TestSuiteRunner'
    
    推荐文章