今天我在带有 nose 的 Ubuntu 9.10 上使用 Python 2.6 运行了一堆 doctests:
nosetests --with-doctest
Ran 0 tests in 0.001s
OK
WTF?我在那些文件中进行了测试,为什么它不起作用?
我将权限更改为 644:
sudo chmod 644 * -R
nosetests --with-doctest
Ran 11 test in 0.004s
FAILED (errors=1)
将其改回 777:
sudo chmod 777 * -R
nosetests --with-doctest
Ran 0 tests in 0.001s
OK
这是为什么呢?使用 644,我什至无法编辑我的文件!
最佳答案
试试 --exe
标志:
$ nosetests --help
...
--exe Look for tests in python modules that are executable.
Normal behavior is to exclude executable modules,
since they may not be import-safe [NOSE_INCLUDE_EXE]
关于python - 为什么 nose 在只有 644 权限的文件中找到测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2378146/