python测试套件,如何在python setup.py中运行测试套件

"本文讲述了在使用Python setup.py进行包管理时,遇到测试用例无法自动运行的问题。解决方法是在setup()函数中添加'test_suite="tests"',以确保测试套件被正确识别。"
摘要由CSDN通过智能技术生成

I am trying to setup a Python package using setup.py. My directory structure looks like this:

setup.py

baxter/

__init__.py

baxter.py

tests/

test_baxter.py

Here is setup.py:

from setuptools import setup, find_packages

setup(name='baxter',

version='1.0',

packages=find_packages()

)

I first do a python setup.py build. When I then run python setup.py test I immediately get this result:

running test

and nothing else. The unit tests have not run since the tests take at least 15 seconds to finish and the message running test comes back right away.

So it appears that python setup.py test is not finding the unit tests. What am I doing wrong?

解决方案

Pretty simple, add the following to your setup() call:

test_suite="tests",

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值