简体   繁体   English

Django-nose 故障 - KeyError: u'en-us'

[英]Django-nose failure - KeyError: u'en-us'

I have all of my TestCase files in a django app called 'tests'.我的所有TestCase文件都在一个名为“tests”的 Django 应用程序中。 Running a specific TestCase works just fine with this command:使用此命令运行特定的TestCase可以正常工作:

python run manage.py test tests.myTestCaseFile

However, when i run the entire set of TestCases in the tests folder this fails:但是,当我在测试文件夹中运行整个测试用例集时,这会失败:

python run manage.py test tests

In this case many ImportErrors are triggered as well as KeyError: 'en-us'.在这种情况下,会触发许多导入错误以及 KeyError: 'en-us'。 Essentially every single TestMethod errors out in one way or another.基本上每个单独的TestMethod都会以一种或另一种方式出错。

Any ideas what could be happening here?任何想法这里可能发生什么?

NOTE: I have already tried to import myapp.urls in the shell and reverse(urlname) works just fine there..注意:我已经尝试在 shell 中导入 myapp.urls 并且 reverse(urlname) 在那里工作得很好..

I've solved this issue:我已经解决了这个问题:

  • KeyError: u'en-us' seems to occur anytime there is an import error in any test module KeyError: u'en-us'似乎在任何测试模块中出现导入错误时都会发生

I had a test file which was testing functionality that did not exist in the current branch.我有一个测试文件,它正在测试当前分支中不存在的功能。

Seems that an import error in any test file prevents execution of the entire test suite.似乎任何测试文件的导入错误都会阻止整个测试套件的执行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM