Luke Melia

personal

February 2, 2007

sqlite3 memory test verbosity

While working on Tracks, I’ve been writing and running a lot of tests. The project has a 181 tests so far (not including Selenium tests). A while back, I switched to using a sqlite3 in-memory database for my tests in an effort to speed them up (about 15% faster for this project).

Tonight, after some planning for Gotham Ruby Conference, I queried the group about something that had been bugging me. While running my tests, I was getting messages like this:

Creating sqlite in memory database
-- create_table("contexts", {:force=>true})
   -> 0.0041s
-- add_index("contexts", ["user_id"], {:name=>"index_contexts_on_user_id"})
   -> 0.0012s

These went on for a screenful, and happened before every test run (which is a lot with autotest -rails!).

Bryan, who works at East Media, suggested that the problem might be specific to sqlite3, and sure enough it went away when I switched to mysql. After that, some targeted searching revealed a solution. It turns out that a more recent version of topfunky‘s memory_test_fix plugin than the one I had has a feature to quiet/silence this annoying output. Thanks to Kakutani Shintaro for contributing this!

test:
  adapter: sqlite3
  database: ":memory:"
  verbosity: silent

I upgraded and am now happy as a clam with my concise, colorful test output.

Now I just have to refactor out these Rails 1.2 deprecation warnings!

Leave a Reply

LukeMelia.com created 1999. ··· Luke Melia created 1976. ··· Live With Passion!