从python鼻子只运行doctests [英] run only doctests from python nose

查看:72
本文介绍了从python鼻子只运行doctests的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使用Python鼻子(nosetests)仅运行doctest? .我不想运行任何单元测试,而只运行doctest.

Is there a way to run only doctests using Python Nose (nosetests)? . I do not want to run any unittests but only and only the doctests.

谢谢.

推荐答案

您可以忽略所有常规测试文件来实现该效果. 使用-I--ignore-files选项以及.*\.py这样的正则表达式可以轻松完成此操作.

You can achieve that effect ignoring all regular test files. This can be done easily using the -I or --ignore-files options and a regex like .*\.py.

另一种方法是将doctest保存在单独的目录中,然后在其上启动鼻子.

An other way could be to save the doctests in a separate directory and launch nose on that.

在较新版本的鼻子中,这似乎不再起作用.

In newer versions of nose this doesn't seem to work anymore.

这篇关于从python鼻子只运行doctests的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆