Django

Code

Ticket #7531 (closed: fixed)

Opened 2 months ago

Last modified 2 months ago

Usage of fixtures to set up sites breaks tests

Reported by: madkinder@gmail.com Assigned to: nobody
Milestone: Component: Uncategorized
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation:
Needs tests: Patch needs improvement:

Description

#7517 led to this bug. One might use fixtures to set up project's sites.

Steps to reproduce:

  1. Create the following initial_data.xml fixture:
    <?xml version="1.0" encoding="utf-8"?>
    <django-objects version="1.0">
      <object pk="1" model="sites.site">
        <field type="CharField" name="domain">127.0.0.1:8000</field>
        <field type="CharField" name="name">testserver</field>
      </object>
    </django-objects>
    
  2. Run ./manage.py test. The test fails with the following message:
    File "/usr/local/lib/python2.5/site-packages/django/contrib/sites/tests.py", line 5, in django.contrib.sites.tests
    Failed example:
        s
    Expected:
        <Site: example.com>
    Got:
        <Site: 127.0.0.1:8000>
    

The reason is obvious: example.com is hardcoded into doctest.

Attachments

Change History

06/25/08 07:09:19 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [7738]) Fixed #7531 -- Modified the sites test so that user-provided initial data doesn't cause breakage when executed from within user applications. Thanks for the report, madkinder@gmail.com.


Add/Change #7531 (Usage of fixtures to set up sites breaks tests)




Change Properties
Action