[New-bugs-announce] [issue22457] load_tests not invoked in root __init__.py when start=package root

Robert Collins report at bugs.python.org
Mon Sep 22 05:47:54 CEST 2014


New submission from Robert Collins:

python -m unittest discover -t . foo

where foo is a package

will not trigger load_tests in foo/__init__.py.

To reproduce:

mkdir -p demo/tests
cd demo
cat <<EOF > tests/__init__.py
import sys
import os

def load_tests(loader, tests, pattern):
    print("HI WE ARE LOADING!")
    this_dir = os.path.dirname(__file__)
    tests.addTest(loader.discover(start_dir=this_dir, pattern=pattern))
    return tests
EOF

python -m unittest discover -t . tests

----------
messages: 227250
nosy: rbcollins
priority: normal
severity: normal
status: open
title: load_tests not invoked in root __init__.py when start=package root

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22457>
_______________________________________


More information about the New-bugs-announce mailing list