X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest.pm;h=c72ed65ef65a72ae3d09ef7b91e50fe234607740;hb=df54756ae88f99969e1576f028324ef94fdb67da;hp=670e180ec64238f6d2715a1172a7d3304a6a7cb2;hpb=08eba48c6e6671c4f686e3f1885fa9c049b10df1;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 670e180..c72ed65 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -143,6 +143,7 @@ END { $SIG{INT} = sub { _cleanup_dbfile(); exit 1 }; +my $need_global_cleanup; sub _cleanup_dbfile { # cleanup if this is us if ( @@ -152,6 +153,10 @@ sub _cleanup_dbfile { or $ENV{DBICTEST_LOCK_HOLDER} == $$ ) { + if ($need_global_cleanup and my $dbh = DBICTest->schema->storage->_dbh) { + $dbh->disconnect; + } + my $db_file = _sqlite_dbfilename(); unlink $_ for ($db_file, "${db_file}-journal"); } @@ -316,6 +321,7 @@ sub init_schema { my $schema; if ($args{compose_connection}) { + $need_global_cleanup = 1; $schema = DBICTest::Schema->compose_connection( 'DBICTest', $self->_database(%args) );