  unusable in a testing context.
  
  Miscellaneous
  -------------
  
  * The ``repr()`` of a ``QuerySet`` is wrapped in ``<QuerySet >`` to
    disambiguate it from a plain list when debugging.
  
 
</s> remove from .models import Article

 </s> add  </s> remove 
    def test_unpickling_when_appregistrynotready(self):
        """
        #24007 -- Verifies that a pickled model can be unpickled without having
        to manually setup the apps registry beforehand.
        """
        script_template = """#!/usr/bin/env python
import pickle

from django.conf import settings

data = %r

settings.configure(DEBUG=False, INSTALLED_APPS=['model_regress'], SECRET_KEY = "blah")
article = pickle.loads(data)
print(article.headline)"""
        a = Article.objects.create(
            headline="Some object",
            pub_date=datetime.datetime.now(),
            article_text="This is an article",
        )

        with NamedTemporaryFile(mode='w+', suffix=".py") as script:
            script.write(script_template % pickle.dumps(a))
            script.flush()
            # A path to model_regress must be set in PYTHONPATH
            model_regress_dir = os.path.dirname(upath(__file__))
            model_regress_path = os.path.abspath(model_regress_dir)
            tests_path = os.path.split(model_regress_path)[0]
            pythonpath = os.environ.get('PYTHONPATH', '')
            pythonpath = npath(os.pathsep.join([tests_path, pythonpath]))

            with mock.patch.dict('os.environ', {'PYTHONPATH': pythonpath}):
                try:
                    result = subprocess.check_output([sys.executable, script.name])
                except subprocess.CalledProcessError:
                    self.fail("Unable to reload model pickled data")
        self.assertEqual(result.strip().decode(), "Some object")
 </s> add  </s> remove         if not apps.ready:
            apps.populate(settings.INSTALLED_APPS)
 </s> add  </s> remove from django.test import TestCase, mock
from django.utils._os import npath, upath
 </s> add from django.test import TestCase </s> remove from django.core.files.temp import NamedTemporaryFile
 </s> add 
Apps registry is no longer auto-populated when unpickling models outside of Django
----------------------------------------------------------------------------------

The apps registry is no longer auto-populated when unpickling models. This was
added in Django 1.7.2 as an attempt to allow unpickling models outside of
Django, such as in an RQ worker, without calling ``django.setup()``, but it
creates the possibility of a deadlock. To adapt your code in the case of RQ,
you can `provide your own worker script <http://python-rq.org/docs/workers/>`_
that calls ``django.setup()``.

  unusable in a testing context.
  
Apps registry is no longer auto-populated when unpickling models outside of Django
----------------------------------------------------------------------------------

The apps registry is no longer auto-populated when unpickling models. This was
added in Django 1.7.2 as an attempt to allow unpickling models outside of
Django, such as in an RQ worker, without calling ``django.setup()``, but it
creates the possibility of a deadlock. To adapt your code in the case of RQ,
you can `provide your own worker script <http://python-rq.org/docs/workers/>`_
that calls ``django.setup()``.

  Miscellaneous
  -------------
  
  * The ``repr()`` of a ``QuerySet`` is wrapped in ``<QuerySet >`` to
    disambiguate it from a plain list when debugging.
  
keep add keep keep keep keep keep keep
 Refs #24007 -- Removed an apps.populate() call in model unpickling that can cause deadlocks. 
docs/releases/1.10.txt