Edgewall Software

Opened 5 years ago

Closed 5 years ago

#12306 closed defect (fixed)

trac.db.tests.api test failures with mysql

Reported by: Christian Boos Owned by: Christian Boos
Priority: normal Milestone: 1.0.10
Component: database backend Version: 1.0dev
Severity: minor Keywords: mysql
Cc: Branch:
Release Notes:

More robust database unit-tests, as MySQL table names are case insensitive by default.

API Changes:
Internal Changes:


The table names are normalized to lower case, when queried in MySQL (on Windows only apparently). This means that the following test will fail, slightly differently according to the branch:

On 1.0-stable:

FAIL: test_table_names (trac.db.tests.api.ConnectionTestCase)
Traceback (most recent call last):
  File "C:\projects\trac\trac\db\tests\api.py", line 502, in test_table_names
    self.assertIn(table.name, db_tables)
AssertionError: 'HOURS' not found in [u'attachment', u'auth_cookie', u'blog', u'cache', u'component', u'enum', u'hours', u'milestone', u'node_change', u'permission', u'report', u'repository', u'revision', u'session', u'session_attribute', u'system', u'ticket', u'ticket_change', u'ticket_custom', u'version', u'wiki']

On trunk:

FAIL: test_get_table_names (trac.db.tests.api.ConnectionTestCase)
Traceback (most recent call last):
  File "C:\projects\trac\trac\db\tests\api.py", line 492, in test_get_table_names
AssertionError: Lists differ: ['HOURS', 'attachment', 'auth_... != [u'attachment', u'auth_cookie'...

First differing element 0:

Diff is 894 characters long. Set self.maxDiff to None to see it.

Attachments (0)

Change History (2)

comment:1 by Jun Omae, 5 years ago

I didn't notice the behavior. It depends on lower_case_table_names system variable which has different default value between platforms, according to MySQL :: MySQL 5.6 Reference Manual :: 9.2.2 Identifier Case Sensitivity.

comment:2 by Christian Boos, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Was fixed in r14420, merged on trunk in r14424.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.