本文介绍了为什么鼻子只有644权限才能在文件中找到测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我在带有鼻子的Ubuntu 9.10上使用Python 2.6运行了许多doctest:

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?我在那些文件中进行了测试,为什么没有用?

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

我将权限更改为644:

I changed permission to 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,我什至无法编辑我的文件!

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

推荐答案

尝试使用--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]

这篇关于为什么鼻子只有644权限才能在文件中找到测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 08:59