Why does nose finds tests in files with only 644 permission?

女生的网名这么多〃 提交于 2019-12-10 03:51:04

问题


Today I ran a bunch of doctests using Python 2.6 on a Ubuntu 9.10 with nose :

nosetests --with-doctest
Ran 0 tests in 0.001s

OK

WTF? I had tests in that files, why didn't that work?

I changed permission to 644:

sudo chmod 644 * -R
nosetests --with-doctest
Ran 11 test in 0.004s

FAILED (errors=1)

Changing it back to 777:

sudo chmod 777 * -R
nosetests --with-doctest
Ran 0 tests in 0.001s

OK

Why is that? Using 644, I can't even edit my files!


回答1:


Try the --exe flag:

$ 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]


来源:https://stackoverflow.com/questions/2378146/why-does-nose-finds-tests-in-files-with-only-644-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!