From e278331f6ab374bbbe7b52b6d97d448817ebab38 Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Wed, 7 Jun 2017 18:49:28 +0300 Subject: [PATCH] PY-24423: Defer django import to prevent AppNotReady exception Can't touch any Django code before django.setup() finished --- python/helpers/pycharm/django_test_manage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/helpers/pycharm/django_test_manage.py b/python/helpers/pycharm/django_test_manage.py index b03a2461cd11..528109c12a3c 100644 --- a/python/helpers/pycharm/django_test_manage.py +++ b/python/helpers/pycharm/django_test_manage.py @@ -5,7 +5,6 @@ import sys from django.core.management import ManagementUtility -from django_test_runner import is_nosetest from pycharm_run_utils import import_system_module from teamcity import teamcity_presence_env_var @@ -108,6 +107,7 @@ class PycharmTestManagementUtility(ManagementUtility): ManagementUtility.__init__(self, argv) def execute(self): + from django_test_runner import is_nosetest if is_nosetest(settings) and "_JB_USE_OLD_RUNNERS" not in os.environ: # New way to run django-nose is to install teamcity-runners plugin # there is no easy way to get qname in 2.7 so string is used