Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#15988 closed Cleanup/optimization (fixed)

django.contrib.contenttypes.tests.ContentTypesTests.test_shortcut_view doesn't handle ABSOLUTE_URL_OVERRIDES

Reported by: paltman Owned by: nobody
Component: contrib.contenttypes Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


When using ABSOLUTE_URL_OVERRIDES setting, the shortcut_view_test causes test failures.

For example, I have:

    "auth.user": lambda o: "/profiles/profile/%s/" % o.username,

and so when running ./ test I get:

FAIL: test_shortcut_view (django.contrib.contenttypes.tests.ContentTypesTests)
Traceback (most recent call last):
  File "/Users/patrick/.virtualenvs/vv/lib/python2.7/site-packages/django/contrib/contenttypes/", line 70, in test_shortcut_view
AssertionError: u'' != ''

I expected this test to handle the case of ABSOLUTE_URL_OVERRIDES being used.

Attached is my patch to the test to match this expectation.

Attachments (3)

fix-contenttypes-test.diff (1.1 KB) - added by paltman 8 years ago.
fix-contenttypes-test.2.diff (1.1 KB) - added by anonymous 8 years ago.
corrected typo
15990.patch (993 bytes) - added by Aymeric Augustin 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by paltman

Attachment: fix-contenttypes-test.diff added

Changed 8 years ago by anonymous

corrected typo

comment:1 Changed 8 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

Patch does not apply cleanly—it was probably not done against trunk.

trunk % patch -p1 < fix-contenttypes-test.2.diff
patching file django/contrib/contenttypes/
Hunk #1 succeeded at 85 with fuzz 2 (offset 20 lines).

I'm attaching a patch which shows another way of fixing this.

Changed 8 years ago by Aymeric Augustin

Attachment: 15990.patch added

comment:2 Changed 8 years ago by dmclain

aaugustin: looks like you accidentally uploaded the wrong patch.

comment:3 Changed 8 years ago by Aymeric Augustin

Damn. I can't dig the original patch out of Time Machine.

If I remember correctly, I suggested to unset ABSOLUTE_URL_OVERRIDES for the duration of the test. We're not testing that ABSOLUTE_URL_OVERRIDES works properly here, and we don't want the tests to depend on user settings.

This can be done nicely since r16237.

comment:4 Changed 8 years ago by Julien Phalip

Patch needs improvement: set
UI/UX: unset

Patch needs improvement as per the comments above.

comment:5 Changed 7 years ago by Claude Paroz

Resolution: fixed
Status: newclosed

I guess that [a6c08a53d37cd91f2073f8744539a4297fd652f3] also fixed this issue.

comment:6 Changed 7 years ago by Claude Paroz <claude@…>

In [2c2c8a63266b586e3782267fb361504e5ac05abe]:

Isolated sitemaps test from ABSOLUTE_URL_OVERRIDES

Refs #15988.

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