Skip to content

Commit

Permalink
Fixed #25941 -- Improved error message for runtests.py when django is…
Browse files Browse the repository at this point in the history
… not on path.
  • Loading branch information
Thomas Allison authored and felixxm committed Apr 13, 2019
1 parent e6d57c4 commit 3e8b733
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@
import tempfile
import warnings

import django
from django.apps import apps
from django.conf import settings
from django.db import connection, connections
from django.test import TestCase, TransactionTestCase
from django.test.runner import default_test_processes
from django.test.selenium import SeleniumTestCaseBase
from django.test.utils import get_runner
from django.utils.deprecation import (
RemovedInDjango31Warning, RemovedInDjango40Warning,
)
from django.utils.log import DEFAULT_LOGGING
try:
import django
except ImportError as e:
raise RuntimeError(
'Django module not found, reference tests/README.rst for instructions.'
) from e
else:
from django.apps import apps
from django.conf import settings
from django.db import connection, connections
from django.test import TestCase, TransactionTestCase
from django.test.runner import default_test_processes
from django.test.selenium import SeleniumTestCaseBase
from django.test.utils import get_runner
from django.utils.deprecation import (
RemovedInDjango31Warning, RemovedInDjango40Warning,
)
from django.utils.log import DEFAULT_LOGGING

try:
import MySQLdb
Expand Down

0 comments on commit 3e8b733

Please sign in to comment.