Code

Opened 2 years ago

Closed 2 years ago

#17647 closed Bug (invalid)

Documentation Bug: override_settings() not in 1.30

Reported by: glen@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords: override_settings
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

According to the documentation for Django 1.3 (confirmed Django 1.3 in 'Version' drop down box on page load):

https://docs.djangoproject.com/en/dev/topics/testing/

In case you want to override a setting for just one test method or even the whole TestCase class, Django provides the override_settings() decorator (see PEP 318). It's used like this:
...
from django.test.utils import override_settings

However, this is not available in 1.3

(glenjarvis)Pokey.local> ./manage.py shell
Python 2.6.1 (r261:67515, Aug  2 2010, 20:10:18) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> print django.VERSION
(1, 3, 0, 'final', 0)
>>> from django.test.utils import override_settings
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: cannot import name override_settings

I have verified, however, that this is available in 1.4 Alpha:

(django14)Pokey.local> python manage.py shell
Python 2.6.1 (r261:67515, Aug  2 2010, 20:10:18) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> print django.VERSION
(1, 4, 0, 'alpha', 1)
>>> from django.test.utils import override_settings
>>> 

Therefore, this is just a documentation error for version.

Attachments (0)

Change History (1)

comment:1 Changed 2 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

The documentation page you reference is not for 1.3, it's the development docs. The equivalent page for 1.3 is https://docs.djangoproject.com/en/1.3/topics/testing/ which indeed does not mention override_settings.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.