为什么鼻子在只有644权限的文件中找到测试?

时间:2010-03-04 09:40:02

标签: python permissions nose doctest

今天我在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,我甚至无法编辑我的文件!

1 个答案:

答案 0 :(得分: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]