question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQLite Crash on Coverage 5.0a2 inside Hypothesis

See original GitHub issue

I was running some unit tests using hypothesis (link) which relies on coverage, and I ran into a crash. Specifically, I received the following error message: coverage.misc.CoverageException: Couldn't use data file '/Users/me/my_project/.coverage': UNIQUE constraint failed: file.path

I have experienced this issue both on macOS and Linux while running python 3.6, and the issue does not persist with COVERAGE_STORAGE=json.

I have included a gist below which contains files to reproduce the error. Specifically, the error occurs when the hypothesis assume statement in test.py fails more than half the time and when wrap is called.

To reproduce the error, run the build.sh script, which will initialize a virtualenv, install required modules, and run a short example which should throw the error.

Additionally, I am including a vagrantfile which will run build.shin a VM, thus providing a clean slate for testing.

https://gist.github.com/TylerADavis/393ee6382b4f645774100ae0c490c5ba

Please let me know if there is any other information I could provide that would be useful.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
blueyedcommented, Oct 23, 2018

I’ve bisected this to d2f77ab2ffc308e616af0207546ee1bef1cb8c75.

The problem appears to be that the file_map is only read when opening the DB, but another subprocess might have added the file later when the ID is needed.

https://github.com/nedbat/coveragepy/pull/723 fixes this for me.

My test case is https://github.com/Vimjas/covimerage/ (https://github.com/Vimjas/covimerage/commit/bb84cc9fbbc1750ce82c5add4d8f7d5a5429bef7), using tox -e py37-coveragepy5-coverage -- -x. (The initial failure is due to an autouse fixture, but also without this it fails, but later.)

To be clear: I am seeing the problem @anarcat mentioned, and which might be different from the original issue, sorry.

0reactions
nedbatcommented, Apr 8, 2019

I would rather not use “isolation_level = immediate” because in the future, writes to the database may not be idempotent (for example, counting line executions, rather than just true/false per line).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release 7.0.0b1 unknown - Coverage.py
Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts.
Read more >
mozilla-release: changeset 682745 ... - Mercurial
Combining data stored in SQLite is now about twice as fast, fixing `issue ... would crash coverage.py with an IndexError (`issue 640`_).
Read more >
Changelog for RPM 5 5.4.10 - ABI laboratory
jbj: l10n: stub in --wnh:l10n.sqlite qf template. ... jbj: tests: add a check-ACID target w db_tool coverage tests.
Read more >
RPM 5-5.1.6: changelog - Linux Upstream Tracker
afb: standalone: file "magic" was installed in wrong directory - jbj: add toplevel lcov-foo Makefile targets. Current coverage at
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found