Py.test搜索

时间:2016-12-13 15:58:00

标签: python pytest

此命令永远不会结束,因为它会在非常深的大数据目录中搜索:

  

py.test --full-trace -k my_test_name

stat("/home/conftest.py", 0x7ffff5e6f1a0) = -1 ENOENT (No such file or directory)
stat("/home/foo3_bar_p/conftest.py", 0x7ffff5e6f1a0) = -1 ENOENT (No such file or directory)
stat("/home/foo3_bar_p/archiv/conftest.py", 0x7ffff5e6f1a0) = -1 ENOENT (No such file or directory)
stat("/home/foo3_bar_p/archiv/specialworkflow/conftest.py", 0x7ffff5e6f1a0) = -1 ENOENT (No such file or directory)
stat("/home/foo3_bar_p/archiv/specialworkflow/239/conftest.py", 0x7ffff5e6f1a0) = -1 ENOENT (No such file or directory)
stat("/home/foo3_bar_p/archiv/specialworkflow/239/57x/conftest.py", 0x7ffff5e6f1a0) = -1 ENOENT (No such file or directory)
stat("/home/foo3_bar_p/archiv/specialworkflow/239/75x", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
stat("/home/foo3_bar_p/archiv/specialworkflow/239/75x", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0

__init__.py中没有/home/foo3_bar_p/archiv/个文件。为什么py-test会扫描这个大目录?

1 个答案:

答案 0 :(得分:0)

因为pytest在测试中不需要__init__.py个文件。

如果您不希望它扫描目录,请将路径传递给pytest,或将其添加到norecursedirs