Modify ↓
Opened 12 years ago
#788 new defect
[PATCH] Code coverage chart fails with PostgreSQL backend
Reported by: | eblot | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.6.2 |
Component: | Build master | Version: | 0.6 |
Keywords: | chart coverage | Cc: | |
Operating System: | BSD |
Description
JSON generated data from http://server/<project>/build/<config>/chart/coverage cannot be parsed, as Bitten triggers an exception with PostgreSQL backend:
2012-10-19 23:27:12,949 Trac[main] ERROR: Exception caught while post-processing request: Traceback (most recent call last): File "/local/engine/trac/trac/web/main.py", line 229, in dispatch self._post_process_request(req) File "/local/engine/trac/trac/web/main.py", line 321, in _post_process_request f.post_process_request(req, *(None,)*extra_arg_count) File "build/bdist.linux-x86_64/egg/revtree/web_ui.py", line 225, in post_process_request if req.perm.has_permission('REVTREE_VIEW'): File "/local/engine/trac/trac/web/api.py", line 303, in __getattr__ value = self.callbacks[name](self) File "/local/engine/trac/trac/web/main.py", line 247, in _get_perm if isinstance(req.session, FakeSession): File "/local/engine/trac/trac/web/api.py", line 303, in __getattr__ value = self.callbacks[name](self) File "/local/engine/trac/trac/web/main.py", line 254, in _get_session return Session(self.env, req) File "/local/engine/trac/trac/web/session.py", line 198, in __init__ self.get_session(req.authname, authenticated=True) File "/local/engine/trac/trac/web/session.py", line 214, in get_session super(Session, self).get_session(sid, authenticated) File "/local/engine/trac/trac/web/session.py", line 71, in get_session """, (sid, int(authenticated))): File "/local/engine/trac/trac/db/util.py", line 124, in execute cursor.execute(query, params) File "/local/engine/trac/trac/db/util.py", line 68, in execute return self.cursor.execute(sql_escape_percent(sql), args) InternalError: current transaction is aborted, commands ignored until end of transaction block InternalError: current transaction is aborted, commands ignored until end of transaction block
This traceback is the consequence of the root cause error, which produces the following traceback:
2012-10-19 23:27:12,950 Trac[main] ERROR: Internal Server Error: Traceback (most recent call last): File "/local/engine/trac/trac/web/main.py", line 478, in _dispatch_request dispatcher.dispatch(req) File "/local/engine/trac/trac/web/main.py", line 198, in dispatch resp = chosen_handler.process_request(req) File "/local/engine/bitten/bitten/web_ui.py", line 801, in process_request category) File "/local/engine/bitten/bitten/report/coverage.py", line 54, in generate_chart_data int(config.max_rev_time(self.env)))) File "/local/engine/trac/trac/db/util.py", line 68, in execute return self.cursor.execute(sql_escape_percent(sql), args) DataError: invalid input syntax for integer: "5.0" DataError: invalid input syntax for integer: "5.0"
It seems the generated data contain float values, while cast expect integer. The following patch fixes the issue with PostgreSQL, I have not tested it with any other DB backend.
-
bitten/report/coverage.py
diff --git a/bitten/report/coverage.py b/bitten/report/coverage.py index 006fb01..365ee42 100644
a b WHERE build.config=%%s AND report.category='coverage' 48 48 GROUP BY build.rev_time, build.rev, build.platform 49 49 ORDER BY build.rev_time""" % (db.cast('item_lines.value', 'int'), 50 50 db.cast('item_lines.value', 'int'), 51 db.cast('item_percentage.value', ' int')),51 db.cast('item_percentage.value', 'float')), 52 52 (config.name, 53 53 config.min_rev_time(self.env), 54 54 config.max_rev_time(self.env)))
Attachments (0)
Note: See
TracTickets for help on using
tickets.