Opened 17 years ago

Closed 17 years ago

#7531 closed (fixed)

Usage of fixtures to set up sites breaks tests

Reported by: madkinder@… Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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.

Change History (1)

comment:1 by Russell Keith-Magee, 17 years ago

Resolution: fixed
Status: newclosed

(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@….

Note: See TracTickets for help on using tickets.
Back to Top