[New-bugs-announce] [issue16662] load_tests not invoked in package/__init__.py

Robert Collins report at bugs.python.org
Tue Dec 11 10:14:51 CET 2012

New submission from Robert Collins:

In loader.py:
                if fnmatch(path, pattern):
                    # only check load_tests if the package directory itself matches the filter
                    name = self._get_name_from_path(full_path)
                    package = self._get_module_from_name(name)
                    load_tests = getattr(package, 'load_tests', None)
                    tests = self.loadTestsFromModule(package, use_load_tests=False)

But pattern is test*.py by default, and packages will never match that.

Its not at all clear why this is special cased at all, but if it is, we'll need a separate pattern. (Its not special cased in the bzrlib implementation that acted as the initial implementation).

messages: 177327
nosy: rbcollins
priority: normal
severity: normal
status: open
title: load_tests not invoked in package/__init__.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list