#33422: Document @isolate_apps
------------------------------------------------+------------------------
Reporter: Adam Johnson | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
`django.test.utils.isolate_apps` is a key tool for keeping Django's test
suite fast and maintainable. It can also be useful for testing third party
packages and projects. For example, I'm currently writing about a custom
system check for model names. The best way I can find to test this check
is to use `@isolate_apps` and create temporary model classes that fail the
check.
`isolate_apps` was added in
https://github.com/django/django/commit/7bb373e3097fe8e000e0bba005ff2dcfc18ab9a5
and has remained stable since, minus refactoring to extract
`TestContextDecorator`.
I can't find much use in the wild, indeed the only result I found in the
first few pages of a GitHub search is from Sage's JSONField backport
package: https://github.com/laymonage/django-jsonfield-
backport/blob/2072fb39b6681f2bf8741e033702920b59238941/tests/test_invalid_models.py#L12
I think it's worth documenting and supporting this tool, which can be
useful in many situations.
--
Ticket URL: <https://code.djangoproject.com/ticket/33422>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.1058d2e43c8ed5dbeb05cb25f0567ae0%40djangoproject.com.