[New-bugs-announce] [issue31840] `ImportError` is` raised` only when `python -m unittest discover` is given

Hiroki “h2” Horiuchi report at bugs.python.org
Sun Oct 22 02:06:57 EDT 2017

New submission from Hiroki “h2” Horiuchi <x19290 at gmail.com>:

Create a package `pkg`. Put `test.py` there. Write `none = None` in `pkg/__init__.py`.
In the directory containing `pkg/`, `python [23] -m unittest pkg.test` will terminate normally, but `python [23] -m unittest discover pkg` will raise `ImportError`. The phenomenon is the same in macOS Sierra, Debian 9.0, Windows 7. I do not think this is a very kind behavior.
Thank you.

components: Library (Lib), Tests, Windows, macOS
files: test.py
messages: 304729
nosy: Hiroki “h2” Horiuchi, ned.deily, paul.moore, ronaldoussoren, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: `ImportError` is` raised` only when `python -m unittest discover` is given
type: behavior
versions: Python 2.7, Python 3.6
Added file: https://bugs.python.org/file47230/test.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list