X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finflate%2Fdatetime_msaccess.t;h=f01219987aee14898faf5b576483fffef71fa2cf;hb=704a0f8ec36f8bd8e273f5ddb553b2f67ea83f06;hp=fdd2284b8690eda7e8c88cd07c7e90ba2f84d0e9;hpb=199fbc453ec03891d0e156d7353c5e992ba4de47;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/inflate/datetime_msaccess.t b/t/inflate/datetime_msaccess.t index fdd2284..f012199 100644 --- a/t/inflate/datetime_msaccess.t +++ b/t/inflate/datetime_msaccess.t @@ -2,7 +2,6 @@ use strict; use warnings; use Test::More; -use Test::Exception; use Scope::Guard (); use Try::Tiny; use DBIx::Class::Optional::Dependencies (); @@ -35,19 +34,17 @@ my @connect_info = ( [ $dsn2, $user2 || '', $pass2 || '' ], ); -my $schema; - for my $connect_info (@connect_info) { my ($dsn, $user, $pass) = @$connect_info; next unless $dsn; - $schema = DBICTest::Schema->connect($dsn, $user, $pass, { + my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { on_connect_call => 'datetime_setup', quote_names => 1, }); - my $guard = Scope::Guard->new(\&cleanup); + my $guard = Scope::Guard->new(sub { cleanup($schema) }); try { local $^W = 0; $schema->storage->dbh->do('DROP TABLE track') }; $schema->storage->dbh->do(<<"SQL"); @@ -83,6 +80,7 @@ done_testing; # clean up our mess sub cleanup { + my $schema = shift; # have to reconnect to drop a table that's in use if (my $storage = eval { $schema->storage }) { local $^W = 0;