运行一组单元测试,由于缺少scipy
模块,导致出现错误。通过nosetests
运行相同命令,我不失败。这怎么可能? nosetests
搜索范围更广还是跳过测试?
使用python -m unittest discover
:
(py37a) gholl@oflws222:~/checkouts/pyorbital/pyorbital/tests> python -m unittest discover
E..EE..
======================================================================
ERROR: test_aiaa (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_aiaa
Traceback (most recent call last):
File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/unittest/loader.py", line 434, in _find_test_path
module = self._get_module_from_name(name)
File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/unittest/loader.py", line 375, in _get_module_from_name
__import__(name)
File "/home/gholl/checkouts/pyorbital/pyorbital/tests/test_aiaa.py", line 36, in <module>
from pyorbital.orbital import _SGDP4, Orbital, OrbitElements
File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/pyorbital/orbital.py", line 31, in <module>
from scipy import optimize
ModuleNotFoundError: No module named 'scipy'
使用nosetests
:
(py37a) gholl@oflws222:~/checkouts/pyorbital/pyorbital/tests> nosetests
......................
----------------------------------------------------------------------
Ran 22 tests in 0.106s
OK
nosetests
应该像python -m unittest discover
那样失败时如何成功?