
theory at bricolage
Apr 30, 2008, 11:50 AM
Post #1 of 1
(111 views)
Permalink
|
|
[8216] Try harder to prevent unnecessary DBI errors.
|
|
Revision: 8216 Author: theory Date: 2008-04-30 11:50:49 -0700 (Wed, 30 Apr 2008) ViewCVS: http://viewsvn.bricolage.cc/?rev=8216&view=rev Log Message: ----------- Try harder to prevent unnecessary DBI errors. Modified Paths: -------------- bricolage/trunk/t/Bric/Test/Runner.pm Modified: bricolage/trunk/t/Bric/Test/Runner.pm =================================================================== --- bricolage/trunk/t/Bric/Test/Runner.pm 2008-04-30 18:33:21 UTC (rev 8215) +++ bricolage/trunk/t/Bric/Test/Runner.pm 2008-04-30 18:50:49 UTC (rev 8216) @@ -37,6 +37,19 @@ use Bric::Test::Base; use Bric::Util::Grp; # Need to load now to prevent warnings later. +BEGIN { + # XXX Delete Bric::Util::DBI::_disconnect() unless we're running dev + # tests or arbitrary tests (in which case it's likely that database- + # specific tests are being run). This is to prevent `make test` from + # throwing an exception when it can't connect to the database in + # _disconnect(). + unless ($ENV{BRIC_DEV_TEST} or ($ENV{BRIC_TEST_CLASSES} &&$ENV{BRIC_TEST_CLASSES} =~ /DevTest\.pm\b/) ) { + require Bric::Util::DBI; + no warnings 'redefine'; + *Bric::Util::DBI::_disconnect = sub {}; + } +} + # Find the tests classes. my @classes; BEGIN { @@ -82,16 +95,6 @@ die "Error loading $c: $@" if $@; } - # XXX Delete Bric::Util::DBI::_disconnect() unless we're running dev - # tests or arbitrary tests (in which case it's likely that database- - # specific tests are being run). This is to prevent `make test` from - # throwing an exception when it can't connect to the database in - # _disconnect(). - unless ($ENV{BRIC_DEV_TEST} or $ENV{BRIC_TEST_CLASSES}) { - require Bric::Util::DBI; - no warnings 'redefine'; - *Bric::Util::DBI::_disconnect = sub {}; - } } # Run the tests.
|