当我测试https://bitbucket.org/petar/beam_integrals时,python setup.py nosetests
我得到了96% 的覆盖率:
----------------------------------------------------------------------
XML: nosetests.xml
Name Stmts Miss Cover Missing
------------------------------------------------------------------------------
beam_integrals 7 7 0% 1-24
beam_integrals.beam_types 79 0 100%
beam_integrals.characteristic_equation_solvers 65 0 100%
beam_integrals.exceptions 6 0 100%
beam_integrals.utils 14 0 100%
------------------------------------------------------------------------------
TOTAL 171 7 96%
----------------------------------------------------------------------
Ran 634 tests in 178.245s
OK (SKIP=3)
但是,如果我测试相同的代码,nosetests
我会得到完全覆盖:
----------------------------------------------------------------------
XML: nosetests.xml
Name Stmts Miss Cover Missing
------------------------------------------------------------------------------
beam_integrals 7 0 100%
beam_integrals.beam_types 79 0 100%
beam_integrals.characteristic_equation_solvers 65 0 100%
beam_integrals.exceptions 6 0 100%
beam_integrals.utils 14 0 100%
------------------------------------------------------------------------------
TOTAL 171 0 100%
----------------------------------------------------------------------
Ran 634 tests in 179.226s
OK (SKIP=3)
似乎python setup.py nosetests
没有正确报告beam_integrals
模块的测试覆盖率。
此问题已在以下位置得到验证:
- 我们的持续集成服务器运行 Ubuntu 10.04 Server 32bit
新创建的 Rackspace 云服务器,运行 Ubuntu 12.04 Server 64 位,设置如下:
$ sudo aptitude update $ sudo aptitude upgrade $ sudo reboot $ sudo aptitude install python-pip mercurial git-core python-gmpy python-dev $ hg clone https://bitbucket.org/petar/beam_integrals $ sudo pip install -r beam_integrals/requirements.txt $ sudo pip install -r beam_integrals/requirements-test.txt $ cd beam_integrals $ python setup.py nosetests $ nosetests