Is directory name `test` treated in a special manner?
If I have a directory named mypackage
, it is recognized as a package without me having to do anything (not even mark it as a source directory or create a __init__.py
file):
If however I simply change the directory's name to test
, it is no longer recognized as a package (import
does not work). Why is that? Is the name test
treated differently? That does not seem to be documented anywhere that I could see.
(Adding a __init__.py
file does get the example to work, but that still does not explain the different behavior based on the name.)
请先登录再写评论。
Hello there,
Could you please check where Jump to definition leads (CTRL/ Command + Click) if you click on test in
from test.testing_util import foo
?Ah, there is a built-in Python package
test
I was not aware of that's being picked up before my own definition oftest
. And, of course, the built-in package does not contain atesting_util
module, so this generates the error.Thanks for helping!