diff --git a/django/test/signals.py b/django/test/signals.py
index 5b0a9a1..4764bd2 100644
a
|
b
|
import os
|
2 | 2 | import time |
3 | 3 | |
4 | 4 | from django.conf import settings |
5 | | from django.db import connections |
6 | 5 | from django.dispatch import receiver, Signal |
7 | 6 | from django.utils import timezone |
8 | 7 | |
… |
… |
setting_changed = Signal(providing_args=["setting", "value"])
|
16 | 15 | |
17 | 16 | @receiver(setting_changed) |
18 | 17 | def update_connections_time_zone(**kwargs): |
| 18 | if kwargs['setting'] not in ('USE_TZ', 'TIME_ZONE'): |
| 19 | return |
19 | 20 | if kwargs['setting'] == 'TIME_ZONE': |
20 | 21 | # Reset process time zone |
21 | 22 | if hasattr(time, 'tzset'): |
… |
… |
def update_connections_time_zone(**kwargs):
|
28 | 29 | # Reset local time zone cache |
29 | 30 | timezone._localtime = None |
30 | 31 | |
| 32 | try: |
| 33 | from django.db import connections |
| 34 | except ImproperlyConfigured: |
| 35 | # No databases setup, quit |
| 36 | return |
| 37 | |
31 | 38 | # Reset the database connections' time zone |
32 | 39 | if kwargs['setting'] == 'USE_TZ' and settings.TIME_ZONE != 'UTC': |
33 | 40 | USE_TZ, TIME_ZONE = kwargs['value'], settings.TIME_ZONE |