通过Python版本使`nosetests`脚本选择文件夹 [英] Making the `nosetests` script select folder by Python version

查看:106
本文介绍了通过Python版本使`nosetests`脚本选择文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经在我的setup.cfg文件中拥有此文件:

I used to have this in my setup.cfg file:

[nosetests]
where=test_python_toolbox

但是现在我通过提供两个并行的代码库来支持Python 2和Python 3,一个在source_py2文件夹中,一个在source_py3文件夹中. setup.py知道如何检查Python版本并选择正确的版本.问题是,我不知道如何制作nosetests,在回购根目录中调用该文件时,请选择正确的文件夹.

But now I'm supporting Python 2 and Python 3 by supplying two parallel codebases, one in the source_py2 folder and one in the source_py3 folder. setup.py knows how to check the Python version and choose the correct one. Problem is, I don't know how to make nosetests, when invoked in the repo root, select the correct folder.

我可以这样:

[nosetests]
where=source_py2/test_python_toolbox

但是随后的测试仅适用于Python2.我希望它们对两个版本都适用.

But then tests would work only for Python 2. I want them to work for both versions.

我可以用一个标志启动nosetests,但是我宁愿不这样做.

I could launch nosetests with a flag, but I'd rather not.

推荐答案

[nosetests]
where=source_py2/test_python_toolbox
py3where=source_py3/test_python_toolbox

这篇关于通过Python版本使`nosetests`脚本选择文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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