# returned results, look through lib, find all mentioned ENVvars and
# set them to true and see if anything explodes
for var in \
+ DBICTEST_SQLITE_USE_FILE \
DBICTEST_SQLITE_REVERSE_DEFAULT_ORDER \
$(grep -P '\$ENV\{' -r lib/ --exclude-dir Optional | grep -oP '\bDBIC\w+' | sort -u | grep -v DBIC_TRACE)
do
cmp_ok(DBICTest->resultset('Artist')->count, '>', 0, 'count is valid');
-# cleanup globaly cached handle so we do not trigger the leaktest
-DBICTest->schema->storage->disconnect;
-
done_testing;
);
is( $it->count, 1, "complex abstract count ok" );
-# cleanup globals so we do not trigger the leaktest
-for ( map { DBICTest->schema->class($_) } DBICTest->schema->sources ) {
- $_->class_resolver(undef);
- $_->resultset_instance(undef);
- $_->result_source_instance(undef);
-}
-{
- no warnings qw/redefine once/;
- *DBICTest::schema = sub {};
-}
-
done_testing;
$SIG{INT} = sub { _cleanup_dbfile(); exit 1 };
+my $need_global_cleanup;
sub _cleanup_dbfile {
# cleanup if this is us
if (
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");
}
my $schema;
if ($args{compose_connection}) {
+ $need_global_cleanup = 1;
$schema = DBICTest::Schema->compose_connection(
'DBICTest', $self->_database(%args)
);
'Expected SQL on correlated realiased subquery'
);
+$schema->storage->disconnect;
+
# test for subselect identifier leakage
# NOTE - the hodge-podge mix of literal and regular identifuers is *deliberate*
for my $quote_names (0,1) {
);
}
+$schema->storage->_dbh->disconnect;
+
# make sure connection-less storages do not throw on _determine_driver
# but work with ENV at the same time
SKIP: for my $env_dsn (undef, (DBICTest->_database)[0] ) {