Packages and modules
peter at engcorp.com
Tue Jul 26 17:06:51 CEST 2005
Dan Richter wrote:
> I'm trying to create a package+module structure, specifically a "test"
> package with all the unit tests. I'd like to have a package (directory)
> "test" that has various test modules, and I'd also like "test" itself to
> be a module that runs all the tests. Is this not possible?
> I created a directory called "test" with an __init__.py file that
> defines a variable __all__. That works, but no executable code in
> __init__.py is executed, even though "import test" seems to succeed. I
> have confirmed that it's not a naming conflict (i.e., there's not some
> other Python module also named "test").
Are you certain? The way to check is with "test.__file__" after
importing test. There _is_ a standard library package called test, and
when I import test here and do this test I get:
More information about the Python-list