From: Dagfinn Ilmari Mannsåker Date: Tue, 23 Sep 2014 18:33:37 +0000 (+0100) Subject: Further delay empty weakregistry assertions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=961d79db;p=dbsrgits%2FDBIx-Class.git Further delay empty weakregistry assertions (extracted from 2c2bc4e5) --- diff --git a/t/cdbi/testlib/MyBase.pm b/t/cdbi/testlib/MyBase.pm index bf55635..1fc77d0 100644 --- a/t/cdbi/testlib/MyBase.pm +++ b/t/cdbi/testlib/MyBase.pm @@ -40,7 +40,10 @@ my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintErr $dbh = DBI->connect(@connect) or die DBI->errstr; my @table; -END { $dbh->do("DROP TABLE $_") foreach @table } +END { + $dbh->do("DROP TABLE $_") for @table; + undef $dbh; +} __PACKAGE__->connection(@connect); diff --git a/t/inflate/datetime_oracle.t b/t/inflate/datetime_oracle.t index 9182f23..98e4b53 100644 --- a/t/inflate/datetime_oracle.t +++ b/t/inflate/datetime_oracle.t @@ -113,7 +113,7 @@ done_testing; # clean up our mess END { - if($schema && (my $dbh = $schema->storage->dbh)) { + if($schema && (my $dbh = $schema->storage->_dbh)) { $dbh->do("DROP TABLE event"); } undef $schema; diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index aa20b0c..e9c83fb 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -343,7 +343,11 @@ sub init_schema { } END { + # Make sure we run after any cleanup in other END blocks + require B; + push @{ B::end_av()->object_2svref }, sub { assert_empty_weakregistry($weak_registry, 'quiet'); + }; } =head2 deploy_schema diff --git a/t/lib/DBICTest/BaseSchema.pm b/t/lib/DBICTest/BaseSchema.pm index cdc7a02..c68d7fd 100644 --- a/t/lib/DBICTest/BaseSchema.pm +++ b/t/lib/DBICTest/BaseSchema.pm @@ -257,7 +257,11 @@ sub clone { } END { - assert_empty_weakregistry($weak_registry, 'quiet'); + # Make sure we run after any cleanup in other END blocks + require B; + push @{ B::end_av()->object_2svref }, sub { + assert_empty_weakregistry($weak_registry, 'quiet'); + }; } 1;