cleanup sqlitedb temporary db file after tests #1607

Merged
merged 2 commits into from Apr 16, 2012

Projects

None yet

2 participants

@minrk
Member
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.

@fperez
Member
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.

@minrk
Member
minrk commented Apr 16, 2012

Sensible, I'll write that up now.

@fperez
Member
fperez commented Apr 16, 2012

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

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

per review by @fperez
4d628d6
@minrk
Member
minrk commented Apr 16, 2012

setup() now creates full temp file.

@fperez
Member
fperez commented Apr 16, 2012

Perfect, thanks! Merging now.

@fperez fperez merged commit f57191a into ipython:master Apr 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment