X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest.pm;fp=t%2Flib%2FDBICTest.pm;h=fa92a95835169f58800c7bcb7574b244c4434615;hb=ee5733658f9bca488689f85a61c9cd7092138f85;hp=a3b5f2f1b92929acf59d6016d0c45a22c4837b4b;hpb=e1d9e578b84f642cb24181d0403b15ab78a9fda7;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index a3b5f2f..fa92a95 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) );