IRC log for #storm on 20090619

00:00.21*** join/#storm shaunm (n=shaunm@c-98-212-133-244.hsd1.il.comcast.net)
05:06.53*** join/#storm seiflotfy1 (n=seif@41.234.7.5)
08:17.03*** join/#storm jukart (i=lovely@81.189.156.94)
10:51.11*** join/#storm WebMaven_ (n=webmaven@c-68-35-136-143.hsd1.nm.comcast.net)
11:00.42*** join/#storm aantn (n=natan@bzq-79-180-17-113.red.bezeqint.net)
11:00.45aantnhello
11:01.29aantnI'm seeing some oddities when using multiple storm databases from the same application
11:01.53aantnare there any known problems with using multiple storm databases?
11:06.10jameshaantn: if you describe your problems maybe we can help
11:12.13aantnjamesh: we have several unit tests that use a storm database
11:12.43aantnthe setUp method creates the database and the tearDown method closes it
11:13.16aantnwhat's weird is that some of the tests fail depending on whether other tests were run first or not
11:13.39aantneach test should be using it's own database, so which other tests are run shouldn't matter
11:14.02jameshhow are you creating the database?
11:15.02aantndb = create_database(storm_url)
11:15.02aantnstore = Store(db)
11:15.37jameshso, create_database() just creates a Database object (used to represent information needed to connect to said database)
11:15.47aantnstorm_url is "sqlite:/tmp/unittest.sqlite"
11:16.00jameshif your test is modifying the underlying database, you should revert those changes in the tearDown()
11:16.08jameshif you don't commit, this can be as simple as store.rollback()
11:16.14jameshif you do commit, it gets a bit more complicated
11:16.37aantnjamesh: what's wrong with just calling store.close() and then creating a new database for the next test?
11:16.50aantnjamesh: the old database file is deleted first
11:16.55jameshhmm
11:17.06jameshfor sqlite, I'd expect deleting the file to be enough
11:18.08aantnjamesh: the unittest file is on launchpad here http://bazaar.launchpad.net/~zeitgeist/zeitgeist/trunk/annotate/head%3A/test/zeitgeist-engine-engine-test.py
11:19.27jameshaantn: that looks like it should be fine
11:20.02aantnjamesh: yeah, there's something wrong with it though, and as far as I can tell it's not in any of our code
11:20.09jameshone option would be to create a temporary directory for each test with mkdtemp() and put the database there
11:20.33jameshthen use shutil.rmtree() in the tearDown after closing the database
11:20.38aantnjamesh: I'm trying that now, but it's stills strange
11:20.45aantnjamesh: I'll let you know if it fixes it
11:21.03jameshaantn: what sort of errors are you getting?
11:22.21jameshthe new "2a" bzr format took one of my repos from 1.1G to 134M
11:22.26jameshpretty good
11:24.28aantnjamesh: one of the unit tests is failing (which is fine) but it stops failing if we remove the other unit tests
11:24.42jameshwhat sort of failure?
11:25.38aantnjamesh: one of the asserts fails
11:26.09jameshI kind of guessed that.  I was wondering what the failure was in case it was relevant to the problem
11:26.31aantnjamesh: I thought that the problem was in our code, and then someone noticed that it stops failing if we don't run any of the other tests first
11:27.10jameshwell, that usually indicates that your tests aren't properly isolated
11:27.43jameshusually a test that updates some global state and does not clean up correctly
11:28.02aantnjamesh: I know :(
11:28.33aantnthe only global variable is the database
11:28.34jamesh(changes on the filesystem can be global state, which is why limiting the test to a temporary directory can help)
11:29.28aantnjamesh: what do you mean?
11:30.44jameshaantn: here's an example from one of my projects (not Storm related): http://bazaar.launchpad.net/~jamesh/pygpgme/trunk/annotate/head%3A/gpgme/tests/util.py
11:31.43jamesha temporary directory is created for each test, and GPG is configured to look for its config file there.
11:32.12aantnjamesh: right
11:32.37jameshthe temporary directory is removed in the test tear down, so there is no way for those changes to impact subsequent tests
11:33.12aantnjamesh: we're doing the same thing though
11:33.33jameshaantn: your code appears to be using the same paths for every test
11:33.44aantnjamesh: yeah
11:33.58aantnthe file is still deleted every time
11:34.18jameshaantn: another issue: don't put asserts in setUp()
11:34.30aantnjamesh: ok
11:34.32jameshpyunit doesn't call tearDown() for tests that fail in setUp()
11:34.46aantnthanks, I didn't know that
11:35.06jameshif any of the failures you saw happened in a setUp(), that could be the cause of your test isolation problem
11:35.38aantnjamesh: they don't
11:36.37jameshaantn: what I was suggesting is that rather than have each test use "sqlite:/tmp/unittest.sqlite", you might have the first use sqlite:/tmp/tmp.XXXX/unittest.sqlite, the second use sqlite:/tmp/tmp.YYYY/unittest.sqlite, etc
11:37.15aantnjamesh: OK, I'm trying it now
11:37.32jameshthe path produced by mkdtemp() is going to be new, so it might avoid the problem
11:43.24aantnjamesh: it's still failing
12:07.19*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
12:35.43*** join/#storm niemeyer (n=niemeyer@200-103-135-47.ctame705.dsl.brasiltelecom.net.br)
13:14.52*** join/#storm goschtl (n=goschtl@p5B0BFD78.dip.t-dialin.net)
13:37.21*** join/#storm aantn (n=natan@bzq-79-180-17-113.red.bezeqint.net)
14:08.48*** join/#storm shaunm (n=shaunm@proxyserver.wolfram.com)
14:27.13*** join/#storm andrea-bs (n=andrea@ubuntu/member/beeseek.developer.andrea-bs)
14:53.24*** join/#storm rockstar (n=rockstar@starscream.eventuallyanyway.com)
15:38.50*** join/#storm andrea-bs (n=andrea@host127-102-dynamic.30-79-r.retail.telecomitalia.it)
15:53.27*** join/#storm jukart (n=jukart@d91-128-122-26.cust.tele2.at)
16:52.33*** join/#storm kanika_vats (n=kanika_v@59.176.111.34)
17:32.00*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
18:40.08*** join/#storm vvinet (n=vince@smtpin.revolutionlinux.com)
19:56.29*** join/#storm vvinet (n=vince@smtpin.revolutionlinux.com)
21:30.56*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
23:22.35*** join/#storm shaunm (n=shaunm@c-98-212-133-244.hsd1.il.comcast.net)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.