Closed mrtyler closed 11 years ago
Taking this.
ERROR Exception while reporting results: UnicodeEncodeError('latin-1', u'Traceback (most recent call last):\n File "./yelp/tests/test_fake.py", line 13, in test_faile_unicode2\n assert False, u\'\u0141\xf3d\u017a is wonderful this time of year.\'\nAssertionError: \\u0141\\xf3d\\u017a is wonderful this time of year.\n', 123, 124, 'ordinal not in range(256)')
Traceback (most recent call last):
File "/nail/home/buck/trees/Testify/testify/plugins/sql_reporter.py", line 279, in report_results
result['previous_run_id'] = insert_single_run(result['previous_run'])
File "/nail/home/buck/trees/Testify/testify/plugins/sql_reporter.py", line 259, in insert_single_run
results = conn.execute(self.TestResults.insert(create_row_to_insert(result, previous_run_id=previous_run_id)))
File "/nail/home/buck/trees/Testify/testify/plugins/sql_reporter.py", line 192, in create_row_to_insert
'failure' : get_failure_id(result['exception_info']),
File "/nail/home/buck/trees/Testify/testify/plugins/sql_reporter.py", line 252, in get_failure_id
'traceback': traceback,
File "/usr/lib/pymodules/python2.6/sqlalchemy/engine/base.py", line 1399, in execute
params)
File "/usr/lib/pymodules/python2.6/sqlalchemy/engine/base.py", line 1532, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/lib/pymodules/python2.6/sqlalchemy/engine/base.py", line 1633, in _execute_context
context)
File "/usr/lib/pymodules/python2.6/sqlalchemy/engine/default.py", line 330, in do_execute
cursor.execute(statement, parameters)
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 172, in execute
query = query % db.literal(args)
File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 275, in literal
return self.escape(o, self.encoders)
File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 203, in unicode_literal
return db.literal(u.encode(unicode_literal.charset))
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u0141' in position 123: ordinal not in range(256)
The solution here was somewhat external to the testify project. Adding 'query: charset: utf8' to the connection yaml causes the MySQLdb driver to use utf8 rather than latin1 in this case, and everything starts working correctly.
This change is demonstrated in #159
Resolved.
This is resolved already. Closing.
Given a test failure like this (from a sandbox_NN builder):
When SqlReporter goes to stick this into the test results database, it throws an exception (reported in the stdio log for sandbox_0):
The result is that this test failure is not displayed in bbmanager (which relies on the work performed by SqlReporter), which is quite bad.
@bukzor thinks this is due to an errant
str()
in SqlReporter that fails on Unicode input.Internal links: