2014-04-03 43 views
1

我有一个项目,它有python2和python3代码(它是一个客户端/服务器的东西;服务器是python3,但有python2和python3客户端)。我用鼻子来处理单元测试。目录布局(目前)基本上就像使用鼻子来测试混合python2和python3代码

client2 
    tests 
client3 
    tests 
server 
    tests 

有没有一种方法来设置或使之与python2正在运行的节点只是取python2测试,同样python3用鼻子。例如,像这样的东西:

client2 
    tests2 
client3 
    tests3 
server 
    tests3 

...有一些合适的鼻子论点。我搞砸了-m选项,但无法获得任何地方。

回答

0

样子你会需要的--where组合和--py3where

--py3where:下Python的3.x的这个目录中

查找测试与'where'功能相同,但只适用于在Python 3.x或更高版本下运行。 请注意,如果在3.x下出现该选项,则该选项将完全替换使用'where'指定的任何 目录,因此'where'选项变为无效的 。 [NOSE_PY3WHERE]所以你

这将是这样的:

nosetests --where=. --where=client2 --py3where=. --py3where=client3 --py3where=server -v 

当使用nosetests与python3它只能运行client3server测试。在python2上运行时,它只会运行client2测试。

另外,看看this question and answers替代品。

相关问题