~ubuntu-branches/ubuntu/quantal/keystone/quantal-security

« back to all changes in this revision

Viewing changes to keystone/common/sql/util.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-06-22 12:27:50 UTC
  • mto: (35.1.1 quantal-proposed)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120622122750-4urdq17en1990apn
Tags: upstream-2012.2~f2~20120622.2353
ImportĀ upstreamĀ versionĀ 2012.2~f2~20120622.2353

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# under the License.
16
16
 
17
17
import os
 
18
import shutil
18
19
 
 
20
from keystone.common.sql import migration
19
21
from keystone import config
20
 
from keystone.common.sql import migration
21
22
 
22
23
 
23
24
CONF = config.CONF
24
25
 
25
26
 
26
27
def setup_test_database():
27
 
    # TODO(termie): be smart about this
28
28
    try:
29
 
        os.unlink('test.db')
 
29
        if os.path.exists('test.db'):
 
30
            os.unlink('test.db')
 
31
        if not os.path.exists('test.db.pristine'):
 
32
            migration.db_sync()
 
33
            shutil.copyfile('test.db', 'test.db.pristine')
 
34
        else:
 
35
            shutil.copyfile('test.db.pristine', 'test.db')
30
36
    except Exception:
31
37
        pass
32
 
    migration.db_sync()