This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest requires __init__.py for test discovery
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ma19, methane, xtreak
Priority: normal Keywords:

Created on 2021-07-08 15:03 by ma19, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg397144 - (view) Author: ma19 (ma19) Date: 2021-07-08 15:03
This is how my project is currently set up:

src:
  - main.py
  - src1.py
  - src2.py
test:
  - __init__.py
  - test_src1.py
  - test_src2.py

If I remove __init__.py from the "test" directory, the unittest discovery fails.

I thought that __init__.py was no longer required since Python 3.3. Will the test discovery be able to work without __init__.py in the future?
msg397145 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2021-07-08 15:18
See also https://bugs.python.org/issue23882
msg397179 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2021-07-09 01:31
And https://dev.to/methane/don-t-omit-init-py-3hga too.
History
Date User Action Args
2022-04-11 14:59:47adminsetgithub: 88752
2021-07-09 01:31:03methanesetnosy: + methane
messages: + msg397179
2021-07-08 15:18:21xtreaksetnosy: + xtreak
messages: + msg397145
2021-07-08 15:03:09ma19create