Enhance exception action test (no functional changes)
[dbsrgits/DBIx-Class.git] / t / cdbi / testlib / MyBase.pm
index 6821a39..1fe9317 100644 (file)
@@ -1,18 +1,29 @@
 package # hide from PAUSE
     MyBase;
 
+use warnings;
 use strict;
-use base qw(DBIx::Class::CDBICompat);
 
 use DBI;
 
-our $dbh;
+use lib 't/lib';
+use DBICTest;
+
+use base qw(DBIx::Class::CDBICompat);
 
 my @connect = (@ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}, { PrintError => 0});
-$dbh = DBI->connect(@connect) or die DBI->errstr;
+# this is only so we grab a lock on mysql
+{
+  my $x = DBICTest::Schema->connect(@connect);
+}
+
+our $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);