Opened 14 years ago

Closed 11 years ago

#16282 closed Bug (wontfix)

CommentTemplateTagTests.testRenderCommentFormFromObjectWithQueryCount fails on MySQL

Reported by: Jonas Obrist Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The test regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests.testRenderCommentFormFromObjectWithQueryCount fails under MySQL with AssertionError: 2 != 1 : 2 queries executed, 1 expected on line 46 on Python 2.5, 2.6 and 2.7.

See http://ci.django-cms.org/job/Django/database=mysql,python=python2.5/57/console

Change History (7)

comment:1 by Jonas Obrist, 14 years ago

Using mysql Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1

Running in --pair mode against text.TextTests.test_cookie_date to make the tests run in an acceptable time

comment:2 by Aymeric Augustin, 14 years ago

Triage Stage: UnreviewedAccepted

The test doesn't fail in isolation:

tests % PYTHONPATH=.. ./runtests.py --settings=test_mysql comment_tests
Creating test database for alias 'default'...
..........................................................................................
----------------------------------------------------------------------
Ran 90 tests in 25.041s

OK
Destroying test database for alias 'default'...
PYTHONPATH=.. ./runtests.py --settings=test_mysql comment_tests  13,78s user 1,53s system 55% cpu 27,642 total

It does in pair mode:

tests % PYTHONPATH=.. ./runtests.py --settings=test_mysql --pair text.TextTests.test_cookie_date

(... snip ...)

***** 94 of 178: Check test pairing with comment_tests
Creating test database for alias 'default'...
..........................................F................................................
======================================================================
FAIL: testRenderCommentFormFromObjectWithQueryCount (regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/myk/Desktop/django-trunk/tests/regressiontests/comment_tests/tests/templatetag_tests.py", line 46, in testRenderCommentFormFromObjectWithQueryCount
    self.assertNumQueries(1, test)
  File "/Users/myk/Desktop/django-trunk/django/test/testcases.py", line 549, in assertNumQueries
    func(*args, **kwargs)
  File "/Users/myk/Desktop/django-trunk/django/test/testcases.py", line 234, in __exit__
    executed, self.num
AssertionError: 2 != 1 : 2 queries executed, 1 expected

(... snip ...)

comment:3 by Bas Peschier, 14 years ago

mysql 5.0.51/py2.5

Normal run:

bpeschier@zeratul:~/dev/python/django/tests$ ./runtests.py --settings=test_mysql comment_tests
Creating test database for alias 'default'...
Creating test database for alias 'other'...
..........................................................................................
----------------------------------------------------------------------
Ran 90 tests in 67.654s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

Pair test:

bpeschier@zeratul:~/dev/python/django/tests$ ./runtests.py --settings=test_mysql --pair text.TextTests.test_cookie_date comment_tests
***** Trying paired execution
***** 1 of 1: Check test pairing with comment_tests
Creating test database for alias 'default'...
Creating test database for alias 'other'...
...........................................................................................
----------------------------------------------------------------------
Ran 91 tests in 67.613s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
***** No problem pair found

So, mysql version related?

comment:4 by Jonas Obrist, 14 years ago

Ran the tests manually now and get the following:

jenkins@pony:~/jobs/Django/workspace/database/mysql/python/python2.6/tests$ python runtests.py --settings=test_mysql comment_tests --pair text.TextTests.test_cookie_date
***** Trying paired execution
***** 1 of 1: Check test pairing with comment_tests
Creating test database for alias 'default'...
Creating test database for alias 'other'...

Running tests...
----------------------------------------------------------------------
..........................................F................................................
======================================================================
FAIL [0.000s]: testRenderCommentFormFromObjectWithQueryCount (regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/jenkins/jobs/Django/workspace/database/mysql/python/python2.6/tests/regressiontests/comment_tests/tests/templatetag_tests.py", line 46, in testRenderCommentFormFromObjectWithQueryCount
    self.assertNumQueries(1, test)
  File "/var/lib/jenkins/jobs/Django/workspace/database/mysql/python/python2.6/tests/django/test/testcases.py", line 549, in assertNumQueries
    func(*args, **kwargs)
  File "/var/lib/jenkins/jobs/Django/workspace/database/mysql/python/python2.6/tests/django/test/testcases.py", line 234, in __exit__
    executed, self.num
AssertionError: 2 != 1 : 2 queries executed, 1 expected

----------------------------------------------------------------------
Ran 91 tests in 16.534s

FAILED (failures=1)

Generating XML reports...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
***** Found problem pair with comment_tests
jenkins@pony:~/jobs/Django/workspace/database/mysql/python/python2.6/tests$ python runtests.py --settings=test_mysql comment_tests
Creating test database for alias 'default'...
Creating test database for alias 'other'...

Running tests...
----------------------------------------------------------------------
..........................................................................................
----------------------------------------------------------------------
Ran 90 tests in 16.689s

OK

Generating XML reports...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
jenkins@pony:~/jobs/Django/workspace/database/mysql/python/python2.6/tests$ python --version
Python 2.6.5
jenkins@pony:~/jobs/Django/workspace/database/mysql/python/python2.6/tests$ mysql --version
mysql  Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1
jenkins@pony:~/jobs/Django/workspace/database/mysql/python/python2.6/tests$ uname -a
Linux pony 2.6.32-31-server #61-Ubuntu SMP Fri Apr 8 19:44:42 UTC 2011 x86_64 GNU/Linux

only seems to fail in pairing mode

comment:5 by Jannis Leidel, 14 years ago

Seems like a caching issue to me, running the postgres tests gives me the same:

[~/Code/git/django/tests] git:master env:django-dev $ python runtests.py --settings=django_testing.mysql comment_tests --pair text.TextTests.test_cookie_date
***** Trying paired execution
***** 1 of 1: Check test pairing with comment_tests
Creating test database for alias 'default'...
..........................................F................................................
======================================================================
FAIL: testRenderCommentFormFromObjectWithQueryCount (regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jezdez/Code/git/django/tests/regressiontests/comment_tests/tests/templatetag_tests.py", line 46, in testRenderCommentFormFromObjectWithQueryCount
    self.assertNumQueries(1, test)
  File "/Users/jezdez/Code/git/django/django/test/testcases.py", line 549, in assertNumQueries
    func(*args, **kwargs)
  File "/Users/jezdez/Code/git/django/django/test/testcases.py", line 234, in __exit__
    executed, self.num
AssertionError: 2 != 1 : 2 queries executed, 1 expected

----------------------------------------------------------------------
Ran 91 tests in 43.983s

FAILED (failures=1)
Destroying test database for alias 'default'...
***** Found problem pair with comment_tests
[~/Code/git/django/tests] git:master env:django-dev $ python runtests.py --settings=django_testing.postgres comment_tests --pair text.TextTests.test_cookie_date
***** Trying paired execution
***** 1 of 1: Check test pairing with comment_tests
Creating test database for alias 'default'...
..........................................F................................................
======================================================================
FAIL: testRenderCommentFormFromObjectWithQueryCount (regressiontests.comment_tests.tests.templatetag_tests.CommentTemplateTagTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jezdez/Code/git/django/tests/regressiontests/comment_tests/tests/templatetag_tests.py", line 46, in testRenderCommentFormFromObjectWithQueryCount
    self.assertNumQueries(1, test)
  File "/Users/jezdez/Code/git/django/django/test/testcases.py", line 549, in assertNumQueries
    func(*args, **kwargs)
  File "/Users/jezdez/Code/git/django/django/test/testcases.py", line 234, in __exit__
    executed, self.num
AssertionError: 2 != 1 : 2 queries executed, 1 expected

----------------------------------------------------------------------
Ran 91 tests in 31.527s

FAILED (failures=1)
Destroying test database for alias 'default'...
***** Found problem pair with comment_tests
[~/Code/git/django/tests] git:master env:django-dev $ python runtests.py --settings=django_testing.mysql comment_tests
Creating test database for alias 'default'...
..........................................................................................
----------------------------------------------------------------------
Ran 90 tests in 47.637s

OK
Destroying test database for alias 'default'...
[~/Code/git/django/tests] git:master env:django-dev $ python runtests.py --settings=django_testing.postgres comment_tests
Creating test database for alias 'default'...
..........................................................................................
----------------------------------------------------------------------
Ran 90 tests in 29.361s

OK
Destroying test database for alias 'default'...

comment:6 by Ramiro Morales, 13 years ago

One extradata point:

I see this only when using the MyISAM MySQL storage backend (and using the --pair text.TextTests.test_cookie_date trick). Inserting prints of connection.queries show that the SQL queries are:

SELECT `comment_tests_article`.`id`, `comment_tests_article`.`author_id`, `comment_tests_article`.`headline` FROM `comment_tests_article` WHERE `comment_tests_article`.`id` = 1 
SELECT `django_content_type`.`id`, `django_content_type`.`name`, `django_content_type`.`app_label`, `django_content_type`.`model` FROM `django_content_type` WHERE (`django_content_type`.`model` = 'article'  AND `django_content_type`.`app_label` = 'comment_tests' )

The second query is the problematic one.

comment:7 by Tim Graham, 11 years ago

Resolution: wontfix
Status: newclosed

Marking as won't fix in light of no recent activity and the fact that contrib.comments is deprecated.

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