tests: Don't regenerate the test database every time we run tests

This cuts about 6 seconds off of the test startup time on my laptop.
The other startup costs are about 1 second for the server to come up
and about half a second for casperjs to begin executing tests.

generate-fixtures now takes a '--force' option that can be use to
force a regeneration of the test database.

(imported from commit 1f473507502f0edf159b2638abb392d9357eb46f)
This commit is contained in:
Zev Benjamin 2013-03-05 17:08:55 -05:00
parent 707796b37b
commit a84947eade
1 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,15 @@
#!/bin/sh -e #!/bin/sh -e
if [ -e zephyr/tests/zephyrdb.test.pristine ]; then
if [ "$1" != "--force" ]; then
cp zephyr/tests/zephyrdb.test.pristine zephyr/tests/zephyrdb.test
exit 0
fi
fi
mkdir -p zephyr/fixtures mkdir -p zephyr/fixtures
rm -f zephyr/tests/zephyrdb.test rm -f zephyr/tests/zephyrdb.test
rm -f zephyr/tests/zephyrdb.test.pristine
# Remove time.pyc to try to prevent it from screwing people importing # Remove time.pyc to try to prevent it from screwing people importing
# time from inside zephyr.lib. We can drop this hack after a bit. # time from inside zephyr.lib. We can drop this hack after a bit.
@ -16,3 +25,5 @@ python manage.py dumpdata --settings=humbug.test_settings \
zephyr.Subscription zephyr.Message zephyr.Huddle zephyr.Realm \ zephyr.Subscription zephyr.Message zephyr.Huddle zephyr.Realm \
zephyr.UserMessage zephyr.Client \ zephyr.UserMessage zephyr.Client \
zephyr.DefaultStream > zephyr/fixtures/messages.json zephyr.DefaultStream > zephyr/fixtures/messages.json
cp zephyr/tests/zephyrdb.test zephyr/tests/zephyrdb.test.pristine