#NEWLINE# @ task #NEWLINE# def setup_testdata( ) : #NEWLINE# #INDENT# 'Create test databases and load test data' #NEWLINE# test_database_parameters = { #NEWLINE# #INDENT# 'apiso' : True , #NEWLINE# 'cite' : True , #NEWLINE# 'harvesting' : False , #NEWLINE# 'manager' : False , #NEWLINE# #UNINDENT# } #NEWLINE# for suite in test_database_parameters . keys ( ) : #NEWLINE# #INDENT# dbfile = ( 'tests/suites/%s/data/records.db' % suite ) #NEWLINE# if os . path . isfile ( dbfile ) : #NEWLINE# #INDENT# os . remove ( dbfile ) #NEWLINE# #UNINDENT# #UNINDENT# for ( database , has_testdata ) in test_database_parameters . items ( ) : #NEWLINE# #INDENT# info ( ( 'Setting up test database %s' % database ) ) #NEWLINE# cfg = path ( ( 'tests/suites/%s/default.cfg' % database ) ) #NEWLINE# sh ( ( 'pycsw-admin.py -c setup_db -f %s' % cfg ) ) #NEWLINE# if has_testdata : #NEWLINE# #INDENT# datapath = path ( ( 'tests/suites/%s/data' % database ) ) #NEWLINE# info ( ( 'Loading test data from %s' % datapath ) ) #NEWLINE# sh ( ( 'pycsw-admin.py -c load_records -f %s -p %s' % ( cfg , datapath ) ) )