fix SCHEMA_LOADER_TESTS_EXTRA_ONLY
Rafael Kitover [Sat, 3 Apr 2010 21:44:24 +0000 (17:44 -0400)]
t/lib/dbixcsl_common_tests.pm

index ce381b1..c8fd70e 100644 (file)
@@ -109,7 +109,9 @@ sub run_only_extra_tests {
 
     plan tests => @$connect_info * (4 + ($self->{extra}{count} || 0));
 
-    foreach my $info (@$connect_info) {
+    foreach my $info_idx (0..$#$connect_info) {
+        my $info = $connect_info->[$info_idx];
+
         @{$self}{qw/dsn user password connect_info_opts/} = @$info;
 
         my $dbh = $self->dbconnect(0);
@@ -123,6 +125,12 @@ sub run_only_extra_tests {
         my $conn = $schema_class->clone;
 
         $self->{extra}{run}->($conn, $monikers, $classes) if $self->{extra}{run};
+
+        if (not ($ENV{SCHEMA_LOADER_TESTS_NOCLEANUP} && $info_idx == $#$connect_info)) {
+            $dbh->do($_) for @{ $self->{extra}{pre_drop_ddl} || [] };
+            $dbh->do("DROP TABLE $_") for @{ $self->{extra}{drop} || [] };
+            rmtree $DUMP_DIR;
+        }
     }
 }