Opened 14 years ago
Closed 14 years ago
#14677 closed (wontfix)
tests.py cannot be split to package always
Reported by: | Jari Pennanen | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | mmcnickle | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
My tests.py
grew too big, and followed advice to split it to package tests
, but not all features are supported that way, which is a shame, there really should be support.
Especially the models defined in tests.py
cannot be moved to individual tests/sometest.py
, even though one imports all from sometest.py
in tests/__init__.py
it keeps throwing error that the model is not created to database.
See also my django-users discussion, for more thorough example.
Change History (4)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Cc: | added |
---|
comment:3 by , 14 years ago
comment:4 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
@carljm makes a fair point. Django's test suite puts models in tests.py, but that isn't a documented capability, and it has some fairly nasty side effects (not the least of which is dirtying of the content types and app cache).
I'm going to marking this closed wontfix; it's an undocumented capability, and rather than paper over the problem, we should be focussing on #7835 to provide the "real" solution.
This is parallel to #4470, which should be fixed by merging the GSOC branch to fix #3591. In the meantime the same workaround (explicit Meta.app_label on the models) works just as well.
It's also possible (I haven't tested) that the #3591 GSOC branch might break the technique of putting models in tests.py entirely; as far as I know that technique has never been documented or officially supported. Though perhaps it should be; seems like a relatively clean solution for #7835.