File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ def pytest_addoption(parser):
18
18
def pytest_configure (config ):
19
19
from django .conf import settings
20
20
21
+ # USE_L10N is deprecated, and will be removed in Django 5.0.
22
+ use_l10n = {"USE_L10N" : True } if django .VERSION < (4 , 0 ) else {}
21
23
settings .configure (
22
24
DEBUG_PROPAGATE_EXCEPTIONS = True ,
23
25
DATABASES = {
@@ -33,7 +35,6 @@ def pytest_configure(config):
33
35
SITE_ID = 1 ,
34
36
SECRET_KEY = 'not very secret in tests' ,
35
37
USE_I18N = True ,
36
- USE_L10N = True ,
37
38
STATIC_URL = '/static/' ,
38
39
ROOT_URLCONF = 'tests.urls' ,
39
40
TEMPLATES = [
@@ -68,6 +69,7 @@ def pytest_configure(config):
68
69
PASSWORD_HASHERS = (
69
70
'django.contrib.auth.hashers.MD5PasswordHasher' ,
70
71
),
72
+ ** use_l10n ,
71
73
)
72
74
73
75
# guardian is optional
Original file line number Diff line number Diff line change @@ -1220,12 +1220,12 @@ class TestNoStringCoercionDecimalField(FieldValues):
1220
1220
1221
1221
1222
1222
class TestLocalizedDecimalField (TestCase ):
1223
- @override_settings (USE_L10N = True , LANGUAGE_CODE = 'pl' )
1223
+ @override_settings (LANGUAGE_CODE = 'pl' )
1224
1224
def test_to_internal_value (self ):
1225
1225
field = serializers .DecimalField (max_digits = 2 , decimal_places = 1 , localize = True )
1226
1226
assert field .to_internal_value ('1,1' ) == Decimal ('1.1' )
1227
1227
1228
- @override_settings (USE_L10N = True , LANGUAGE_CODE = 'pl' )
1228
+ @override_settings (LANGUAGE_CODE = 'pl' )
1229
1229
def test_to_representation (self ):
1230
1230
field = serializers .DecimalField (max_digits = 2 , decimal_places = 1 , localize = True )
1231
1231
assert field .to_representation (Decimal ('1.1' )) == '1,1'
You can’t perform that action at this time.
0 commit comments