Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry in the case of failures. #1010 #1071

Merged
merged 1 commit into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ Unreleased
- When using ``--source`` on a large source tree, v5.x was slower than previous
versions. This performance regression is now fixed, closing `issue 1037`_.

- Mysterious SQLite errors can happen on PyPy, as reported in `issue 1010`_. An
immediate retry seems to fix the problem, although it is an unsatisfying
solution.

- Continuous integration has moved from Travis and AppVeyor to GitHub Actions.

.. _issue 1037: https://github.com/nedbat/coveragepy/issues/1037
.. _issue 1010: https://github.com/nedbat/coveragepy/issues/1010


.. _changes_53:
Expand Down
8 changes: 7 additions & 1 deletion coverage/sqldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,13 @@ def execute(self, sql, parameters=()):
tail = " with {!r}".format(parameters) if parameters else ""
self.debug.write("Executing {!r}{}".format(sql, tail))
try:
return self.con.execute(sql, parameters)
try:
return self.con.execute(sql, parameters)
except Exception:
# In some cases, an error might happen that isn't really an
# error. Try again immediately.
# https://github.com/nedbat/coveragepy/issues/1010
return self.con.execute(sql, parameters)
except sqlite3.Error as exc:
msg = str(exc)
try:
Expand Down