将摊铺机和鼻子与非典型目录结构一起使用
我正在尝试为 Paver
编写一个任务,它将在我的文件上运行 nosetests
。
我的目录结构如下所示:
project/
file1.py
file2.py
file3.py
build/
pavement.py
subproject/
file4.py
test/
file5.py
file6.py
Doctests(使用 --with_doctest
选项)应该在所有 *.py 文件上运行,而仅在 project/test
下的文件运行(在此示例中,应搜索 file5.py
和 file6.py
) 来查找测试例程。
我似乎不知道如何做到这一点 - 我可以为 nose
编写一个自定义插件,其中包含正确的文件,但我似乎无法获取 paver
> 在调用 nosetests
任务之前构建并安装它。 我也找不到一种方法让 paver
在命令行上将要测试的文件列表传递给 nosetests
。
让它发挥作用的最佳方法是什么?
I'm trying to write a task for Paver
that will run nosetests
on my files.
My directory structure looks like this:
project/
file1.py
file2.py
file3.py
build/
pavement.py
subproject/
file4.py
test/
file5.py
file6.py
Doctests (using the --with_doctest
option) should be run on all the *.py files, while only the files under project/test
(in this example, file5.py
and file6.py
) should be searched for test routines.
I can't seem to figure out how to do this--I can write a custom plugin for nose
which includes the correct files, but I can't seem to get paver
to build and install it before calling the nosetests
task. I also can't find a way to get paver
to pass a list of files to test to nosetests
on the command line.
What's the best way of getting this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这与您想要达到的目标完全接近吗?
我实际上不确定如何告诉鼻子查看特定文件,但这是命令行选项的问题。
--where
允许您指定一个目录,但我没有找到一种方法来表示“此处仅运行 doctests,此处运行其他测试”。 您可能需要两次调用sh('nosetests')
来完成所有这些操作。Is this at all close to what you're trying to get at?
I'm not actually sure how to tell nose to look in specific files, but that's a matter of command-line options.
--where
lets you specify a directory, but I don't see a way to say "run only doctests here, and other tests here". You may need two invocations ofsh('nosetests')
to do all that.