equal
deleted
inserted
replaced
538 |
538 |
539 ### postgres test database handling ############################################ |
539 ### postgres test database handling ############################################ |
540 |
540 |
541 def startpgcluster(pyfile): |
541 def startpgcluster(pyfile): |
542 """Start a postgresql cluster next to pyfile""" |
542 """Start a postgresql cluster next to pyfile""" |
543 datadir = join(os.path.dirname(pyfile), 'data', |
543 datadir = join(os.path.dirname(pyfile), 'data', 'database', |
544 'pgdb-%s' % os.path.splitext(os.path.basename(pyfile))[0]) |
544 'pgdb-%s' % os.path.splitext(os.path.basename(pyfile))[0]) |
545 if not exists(datadir): |
545 if not exists(datadir): |
546 try: |
546 try: |
547 subprocess.check_call(['initdb', '-D', datadir, '-E', 'utf-8', '--locale=C']) |
547 subprocess.check_call(['initdb', '-D', datadir, '-E', 'utf-8', '--locale=C']) |
548 |
548 |
577 raise |
577 raise |
578 |
578 |
579 |
579 |
580 def stoppgcluster(pyfile): |
580 def stoppgcluster(pyfile): |
581 """Kill the postgresql cluster running next to pyfile""" |
581 """Kill the postgresql cluster running next to pyfile""" |
582 datadir = join(os.path.dirname(pyfile), 'data', |
582 datadir = join(os.path.dirname(pyfile), 'data', 'database', |
583 'pgdb-%s' % os.path.splitext(os.path.basename(pyfile))[0]) |
583 'pgdb-%s' % os.path.splitext(os.path.basename(pyfile))[0]) |
584 subprocess.call(['pg_ctl', 'stop', '-D', datadir, '-m', 'fast']) |
584 subprocess.call(['pg_ctl', 'stop', '-D', datadir, '-m', 'fast']) |
585 try: |
585 try: |
586 os.rmdir(DEFAULT_PSQL_SOURCES['system']['db-host']) |
586 os.rmdir(DEFAULT_PSQL_SOURCES['system']['db-host']) |
587 except OSError: |
587 except OSError: |