#30403 closed Bug (invalid)
Test namespace packages discover fails to load module.
Reported by: | Jonny Fuller | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 2.2 |
Severity: | Normal | Keywords: | namespace packages |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hello friends. Test discovery with namespaced packages fails when selecting a subpackage because of the way unittest discover evaluates paths. A reproducible example repository and full documentation can be found here. However, if you test the entire namespace, or a specific test module, everything works.
I'm not sure what the solution is, but it may have something to do with how the test runner calls discover.
<EDIT> I tried the same situation with just the normal Python unittest module discovery and it still occurs. Looks like this may be a Python problem and not a Django problem.
Change History (4)
comment:1 by , 6 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Summary: | Test namespace packages discover fails to load module → Test namespace packages discover fails to load module. |
comment:3 by , 6 years ago
Replying to felixxm:
Thanks for the report, however it is not an issue in Django. IMO
namespace/__init__.py
is missing.touch namespace/__init__.py
fixed all issues for me.
Hi felixxm. Namespace packages are not supposed to have an init. Anyway, this is a Python bug not a Django bug so I reported it https://bugs.python.org/issue36723 but I don't see any movement on it.
comment:4 by , 5 years ago
Adding a \_\_init\_\_.py prevents distrubition from outside the current directory contribuitng to the namepscae packages; so would in my case break my application. ( But this I'l follwo this up on the cpython bug )
Thanks for the report, however it is not an issue in Django. IMO
namespace/__init__.py
is missing.touch namespace/__init__.py
fixed all issues for me.