【问题标题】:Why does nose finds tests in files with only 644 permission?为什么鼻子只能在只有 644 权限的文件中找到测试?
【发布时间】:2011-01-23 14:29:12
【问题描述】:

今天我在带有鼻子的 Ubuntu 9.10 上使用 Python 2.6 运行了一堆文档测试:

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 小时前发布了它,它已经是 Google 中“鼻子权限 644”的第一个条目。我不知道最让我吃惊的是什么:成名了多少,或者谷歌的速度有多快。
  • 为什么不能编辑文件?第644章

标签: python permissions nose doctest


【解决方案1】:

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

【讨论】:

  • 我很想了解为什么 --exe 不是默认行为。花了一段时间才发现这个问题!啊!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-03
  • 2018-03-05
  • 1970-01-01
  • 1970-01-01
  • 2021-03-28
  • 1970-01-01
相关资源
最近更新 更多