为什么nose会在仅有644权限的文件中找到测试?
今天我在 Ubuntu 9.10 上用 Python 2.6 跑了一堆 doctests,使用的是 nose:
nosetests --with-doctest
Ran 0 tests in 0.001s
OK
这是什么情况?我明明在那些文件里有测试,为什么不管用呢?
我把文件权限改成了 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 的话,我连文件都没法编辑!
1 个回答
11
试试这个 --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]