python - 如何使用不同版本的 Python 运行 Python Nose 测试

标签 python unit-testing centos nose

我们有带有古老 Python 2.4 解释器的 CentOS。

但我们想用更新的 2.5/2.6 语法编写测试。

假设我们安装了第二个 Python 解释器(例如 python2.6),有什么办法吗 运行 'nosetests' shell 命令并告诉它使用特定的 Python 解释器而不是默认解释器?

最佳答案

nosetests 文件在 Python 中,因此只需在新版本中运行它即可。查找文件所在的位置:

which nosetests

然后:

python2.6 /usr/bin/nosetests

调整名称和路径以匹配您的系统。我还没有测试过,但这应该可以。

关于python - 如何使用不同版本的 Python 运行 Python Nose 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4463240/

相关文章:

python - 尝试/捕捉或验证速度?

python - Twisted同时执行10个线程并等待结果

django - 需要在 pytest 工厂中覆盖 django auto_now_add

centos - Sendmail 无法向 Internet 发送信件(仅发送本地邮件)

python - 在 Django 模型中为 id 设置自动递增初始值

python - 如何在python中完全退出服务器?

c++ - 单元测试 ActiveX 控件 (C++)

.net - 如何在 NSubstitute 中使用私有(private) setter 模拟对象的索引器?

email - 创建电子邮件帐户时出现 cPanel 错误。错误 : No specific error was returned with the failed API Call

nginx - 在 CentOS 7 上支持 HTTP/2 ALPN 的乘客 nginx