]> git.decadent.org.uk Git - dak.git/blob - tests/create_pickle_file.py
debianqueued: No early notifications
[dak.git] / tests / create_pickle_file.py
1 #!/usr/bin/python
2
3 # recreate the pickle file db-metadata-*.pkl that needs to be updated
4 # after a database upgrade
5
6 from sqlalchemy import create_engine, __version__
7
8 import pickle
9 import sys
10 from os.path import abspath, dirname
11
12 DAK_TEST_DIR = dirname(abspath(__file__))
13 DAK_ROOT_DIR = dirname(DAK_TEST_DIR)
14 if DAK_ROOT_DIR not in sys.path:
15     sys.path.insert(0, DAK_ROOT_DIR)
16
17 from daklib.dbconn import DBConn
18
19 pickle_filename = '%s/fixtures/db-metadata-%s.pkl' % (DAK_TEST_DIR, __version__)
20 pickle_file = open(pickle_filename, 'w')
21 metadata = DBConn().db_meta
22 pickle.dump(metadata, pickle_file)
23 pickle.dump(metadata.ddl_listeners, pickle_file)
24 pickle_file.close()
25 print "File %s has been updated successfully." % pickle_filename