File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -34,24 +34,24 @@ def f(cmdline):
3434
3535def setup (pgdata = None , log = "db_test.log" , user = "postgres" ):
3636 if pgdata is None :
37- pgdata = TemporaryDirectory (). name
37+ pgdata = TemporaryDirectory ()
3838
3939 log = Path (log )
4040 try :
4141 log .unlink ()
4242 except FileNotFoundError :
4343 pass
4444
45- initdb (f"-D { pgdata } --auth-local=trust --no-sync -U postgres" )
46- pg_ctl (f'-D { pgdata } -o "-k { pgdata } -h \\ "\\ "" -l { log } start' )
45+ initdb (f"-D { pgdata . name } --auth-local=trust --no-sync -U postgres" )
46+ pg_ctl (f'-D { pgdata . name } -o "-k { pgdata . name } -h \\ "\\ "" -l { log } start' )
4747 sleep (3 )
48- con_str = f"host={ pgdata } user={ user } "
48+ con_str = f"host={ pgdata . name } user={ user } "
4949 return pgdata , con_str
5050
5151
5252def teardown (pgdata ):
53- msg = pg_ctl (f"-D { pgdata } stop" )
54- shutil . rmtree ( pgdata )
53+ msg = pg_ctl (f"-D { pgdata . name } stop" )
54+ pgdata . cleanup ( )
5555 return msg
5656
5757
You can’t perform that action at this time.
0 commit comments