Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12724 closed (fixed)

get_comment_permalink tests failing on Postgres

Reported by: carljm Owned by: kmtracey
Component: contrib.comments Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The tests for get_comment_permalink rely on created comments having specific IDs. Postgres transaction rollbacks don't reset sequences (apparently), so the created comments have much higher IDs than expected under Postgres.

Best fix isn't immediately apparent to me: either the actual comment id needs to be stored somewhere the test can get at it, or the test needs to query for the comment to get the id, or the assertion needs to be agnostic about the actual id.

(test_env)carljm@kale:~/projects/django/django/django-hg$ python tests/ comment_tests
FAIL: testGetCommentPermalink (regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests)
Traceback (most recent call last):
  File "/home/carljm/projects/django/django/django-hg/tests/regressiontests/comment_tests/tests/", line 75, in testGetCommentPermalink
    self.assertEqual(out, "/cr/%s/%s/#c2" % (,
AssertionError: u'/cr/13/1/#c71' != '/cr/13/1/#c2'

FAIL: testGetCommentPermalinkFormatted (regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests)
Traceback (most recent call last):
  File "/home/carljm/projects/django/django/django-hg/tests/regressiontests/comment_tests/tests/", line 84, in testGetCommentPermalinkFormatted
    self.assertEqual(out, "/cr/%s/%s/#c2-by-Joe Somebody" % (,
AssertionError: u'/cr/13/1/#c75-by-Joe Somebody' != '/cr/13/1/#c2-by-Joe Somebody'

Ran 81 tests in 3.114s

FAILED (failures=2)

Change History (3)

comment:1 Changed 7 years ago by kmtracey

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to kmtracey
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.1 to SVN

We already have the comment ids, the tests just need to use them.

comment:2 Changed 7 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [12345]) Fixed #12724: Fixed new comment tests to not hardcode comment primary key values. Thanks carljm.

comment:3 Changed 5 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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