Nosetest 包括不需要的父目录
我试图将鼻子测试限制到特定目录,但是在测试运行期间,它包括我要定位的目录的父目录,这样做会引发错误。
以下是测试运行输出的关键元素:
nose.importer: DEBUG: Add path /projects/myproject/myproject/specs
nose.importer: DEBUG: Add path /projects/myproject/myproject
nose.importer: DEBUG: Add path /projects/myproject
nose.importer: DEBUG: insert /projects/myproject into sys.path
我将 buildout
与 pbp.recipe.noserunner
结合使用。这是相关的 /projects/myproject/buildout.cfg
部分:
[specs]
recipe = pbp.recipe.noserunner
eggs =
pbp.recipe.noserunner
${buildout:eggs}
figleaf
pinocchio
working-directory =
myproject/specs
defaults =
-vvv
--exe
--include ^(it|ensure|must|should|specs?|examples?)
--include (specs?(.py)?|examples?(.py)?)$
--with-spec
--spec-color
我还尝试将 where=myproject/specs
设置为 默认值
之一参数帮助限制导入但仍然没有乐趣。
对我哪里出错有什么建议吗?
编辑:
我尝试--排除
父目录,但没有任何乐趣。
I'm trying to limit nosetests to a specific directory, however during the test run it's including the parent directories of the dir I'm targetting and in doing so throws errors.
Here's the key elements of output from the test run:
nose.importer: DEBUG: Add path /projects/myproject/myproject/specs
nose.importer: DEBUG: Add path /projects/myproject/myproject
nose.importer: DEBUG: Add path /projects/myproject
nose.importer: DEBUG: insert /projects/myproject into sys.path
I'm using buildout
with pbp.recipe.noserunner
. Here's the relevant /projects/myproject/buildout.cfg
section:
[specs]
recipe = pbp.recipe.noserunner
eggs =
pbp.recipe.noserunner
${buildout:eggs}
figleaf
pinocchio
working-directory =
myproject/specs
defaults =
-vvv
--exe
--include ^(it|ensure|must|should|specs?|examples?)
--include (specs?(.py)?|examples?(.py)?)$
--with-spec
--spec-color
I've also tried setting where=myproject/specs
as one of the defaults
parameters to help limit the import but still no joy.
Any suggestions on where I'm going wrong?
Edit:
I've tried to --exclude
the parent directories but no joy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您正在期待以下行为。
为什么不尝试使用
--match
或--exclude
模式来限制测试集?尝试:
我检查nose.importer的源代码:nose递归地add_path规范的父包。
我认为除非你创建一个特定的导入器,否则你无法绕过这个......
我不知道鼻子 API 是否可能。
I suppose that you are expecting the following behavior.
Why not try a
--match
or an--exclude
pattern to restrict the tests set ?Try:
I check the source code of nose.importer : nose recursivly add_path the parents packages of specs.
I think that you cannot bypass this unless you create a specific importer...
I do not not know if this is possible this the nose API.