cleanup sqlitedb temporary db file after tests #1607

Merged
merged 2 commits into from Apr 16, 2012

Conversation

Projects
None yet
2 participants
Owner

minrk commented Apr 15, 2012

Avoids

...
[Application] Table _ exists and doesn't match db format, trying __1
[Application] keys mismatch

messages in the test suite, which could happen if the test suite was run in relatively quick succession across db-format changes.

Owner

fperez commented Apr 16, 2012

Wouldn't it be better for that file to be created with tempfile instead of having a fixed 'tasks.db' name? That way, a stray /tmp/tasks.db file can't cause problems. A scenario where that could occur: user 1 runs the suite before this cleanup fix or with a crash that for some reason prevents cleanup, then user 2 on the same machine can't run the tests anymore because he can't create/write to /tmp/tasks.db. Making that filename with the tempfile machinery will prevent this, it can be simply a module-level global created in setup() and deleted in teardown() just like now, but with a random name made by tempfile.

Owner

minrk commented Apr 16, 2012

Sensible, I'll write that up now.

Owner

fperez commented Apr 16, 2012

Awesome, thx. I'll review and merge quickly.

generate random task db in tests
avoids potential conflict with simultaneous test runs

per review by @fperez
Owner

minrk commented Apr 16, 2012

setup() now creates full temp file.

Owner

fperez commented Apr 16, 2012

Perfect, thanks! Merging now.

fperez added a commit that referenced this pull request Apr 16, 2012

Merge pull request #1607 from minrk/cleanup_sqlitedb
cleanup sqlitedb temporary db file after tests, and make the temp db file have a random name to avoid possible collisions with simultaneous test runs.

@fperez fperez merged commit f57191a into ipython:master Apr 16, 2012

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014

Merge pull request #1607 from minrk/cleanup_sqlitedb
cleanup sqlitedb temporary db file after tests, and make the temp db file have a random name to avoid possible collisions with simultaneous test runs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment