From: Marcus Ramberg Date: Fri, 27 Jan 2006 17:13:58 +0000 (+0000) Subject: made cdbi-t optional X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=289ba852733fc488dc43cd474f47780f7fa1771e;p=dbsrgits%2FDBIx-Class-Historic.git made cdbi-t optional --- diff --git a/Build.PL b/Build.PL index 629829c..db515d4 100644 --- a/Build.PL +++ b/Build.PL @@ -19,8 +19,6 @@ my %arguments = ( 'Storable' => 0, 'Class::Data::Accessor' => 0.01, # Following for CDBICompat only - 'Class::Trigger' => 0, - 'DBIx::ContextualFetch' => 0, 'Carp::Clan' => 0, }, recommends => { diff --git a/Changes b/Changes index a7780a2..c95b8df 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for DBIx::Class + - removed cdbi-t dependencies, only run tests if installed - Removed DBIx::Class::Exception - unified throw_exception stuff, using Carp::Clan - report query when sth generation fails. diff --git a/lib/DBIx/Class/CDBICompat.pm b/lib/DBIx/Class/CDBICompat.pm index 4d0d412..0a45f18 100644 --- a/lib/DBIx/Class/CDBICompat.pm +++ b/lib/DBIx/Class/CDBICompat.pm @@ -3,6 +3,13 @@ package DBIx::Class::CDBICompat; use strict; use warnings; use base qw/DBIx::Class::Core DBIx::Class::DB/; +use Carp::Clan qw/^DBIx::Class/; + +eval { + require Class::Trigger; + require DBIx::ContextualFetch; +}; +croak "Class::Trigger and DBIx::ContextualFetch is required for CDBICompat" if $@; __PACKAGE__->load_own_components(qw/ Constraints diff --git a/t/cdbi-sweet-t/08pager.t b/t/cdbi-sweet-t/08pager.t index ea77d81..9650315 100644 --- a/t/cdbi-sweet-t/08pager.t +++ b/t/cdbi-sweet-t/08pager.t @@ -3,10 +3,15 @@ use warnings; use Test::More; -eval "use DBD::SQLite"; -plan skip_all => 'needs DBD::SQLite for testing' if $@; - -plan tests => 10; +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 10); +} use lib 't/lib'; diff --git a/t/cdbi-t/01-columns.t b/t/cdbi-t/01-columns.t index 09cae07..7d3f0bf 100644 --- a/t/cdbi-t/01-columns.t +++ b/t/cdbi-t/01-columns.t @@ -1,6 +1,12 @@ use strict; -use Test::More tests => 24; +use Test::More; + +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 24); +} + #----------------------------------------------------------------------- # Make sure that we can set up columns properly diff --git a/t/cdbi-t/02-Film.t b/t/cdbi-t/02-Film.t index b31ea5f..f55d8cd 100644 --- a/t/cdbi-t/02-Film.t +++ b/t/cdbi-t/02-Film.t @@ -3,8 +3,13 @@ use Test::More; $| = 1; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 96); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 96); } INIT { diff --git a/t/cdbi-t/03-subclassing.t b/t/cdbi-t/03-subclassing.t index 75b70d6..fe42785 100644 --- a/t/cdbi-t/03-subclassing.t +++ b/t/cdbi-t/03-subclassing.t @@ -1,6 +1,11 @@ use strict; use Test::More; +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 24); +} + #---------------------------------------------------------------------- # Make sure subclasses can be themselves subclassed #---------------------------------------------------------------------- diff --git a/t/cdbi-t/04-lazy.t b/t/cdbi-t/04-lazy.t index 9db9e27..b9e3370 100644 --- a/t/cdbi-t/04-lazy.t +++ b/t/cdbi-t/04-lazy.t @@ -1,6 +1,11 @@ use strict; use Test::More; +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 24); +} + #---------------------------------------------------------------------- # Test lazy loading #---------------------------------------------------------------------- diff --git a/t/cdbi-t/06-hasa.t b/t/cdbi-t/06-hasa.t index 178b044..94757c3 100644 --- a/t/cdbi-t/06-hasa.t +++ b/t/cdbi-t/06-hasa.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 24); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 24); } @YA::Film::ISA = 'Film'; diff --git a/t/cdbi-t/09-has_many.t b/t/cdbi-t/09-has_many.t index 2ff2633..2af5485 100644 --- a/t/cdbi-t/09-has_many.t +++ b/t/cdbi-t/09-has_many.t @@ -1,9 +1,12 @@ use strict; use Test::More; + BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 30); + eval "use DBIx::Class::CDBICompat;"; + plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@; + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 30); } diff --git a/t/cdbi-t/11-triggers.t b/t/cdbi-t/11-triggers.t index 9e36c54..5626763 100644 --- a/t/cdbi-t/11-triggers.t +++ b/t/cdbi-t/11-triggers.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 13); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 13); } use lib 't/testlib'; diff --git a/t/cdbi-t/12-filter.t b/t/cdbi-t/12-filter.t index ecaff02..c161602 100644 --- a/t/cdbi-t/12-filter.t +++ b/t/cdbi-t/12-filter.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 50); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 50); } use lib 't/testlib'; diff --git a/t/cdbi-t/13-constraint.t b/t/cdbi-t/13-constraint.t index c25227a..02e8cdf 100644 --- a/t/cdbi-t/13-constraint.t +++ b/t/cdbi-t/13-constraint.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 23); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 23); } use lib 't/testlib'; diff --git a/t/cdbi-t/14-might_have.t b/t/cdbi-t/14-might_have.t index edce8a3..40b186e 100644 --- a/t/cdbi-t/14-might_have.t +++ b/t/cdbi-t/14-might_have.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 18); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 18); } use lib 't/testlib'; diff --git a/t/cdbi-t/15-accessor.t b/t/cdbi-t/15-accessor.t index 2f7c85c..e683f7d 100644 --- a/t/cdbi-t/15-accessor.t +++ b/t/cdbi-t/15-accessor.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 53); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 53); } INIT { diff --git a/t/cdbi-t/16-reserved.t b/t/cdbi-t/16-reserved.t index 7e67411..2973ce1 100644 --- a/t/cdbi-t/16-reserved.t +++ b/t/cdbi-t/16-reserved.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 5); } use lib 't/testlib'; diff --git a/t/cdbi-t/18-has_a.t b/t/cdbi-t/18-has_a.t index b0f0299..d2fe462 100644 --- a/t/cdbi-t/18-has_a.t +++ b/t/cdbi-t/18-has_a.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 41); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 41); } use lib 't/testlib'; diff --git a/t/cdbi-t/19-set_sql.t b/t/cdbi-t/19-set_sql.t index f3590d5..36b66af 100644 --- a/t/cdbi-t/19-set_sql.t +++ b/t/cdbi-t/19-set_sql.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 17); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 17); } use lib 't/testlib'; diff --git a/t/cdbi-t/21-iterator.t b/t/cdbi-t/21-iterator.t index 2f34c11..3c84f4c 100644 --- a/t/cdbi-t/21-iterator.t +++ b/t/cdbi-t/21-iterator.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 33); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 33); } use lib 't/testlib'; diff --git a/t/cdbi-t/22-self_referential.t b/t/cdbi-t/22-self_referential.t index 29d0704..c2ce6e1 100644 --- a/t/cdbi-t/22-self_referential.t +++ b/t/cdbi-t/22-self_referential.t @@ -1,4 +1,9 @@ -use Test::More tests => 2; +use Test::More; + +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 24); +} use strict; diff --git a/t/cdbi-t/30-pager.t b/t/cdbi-t/30-pager.t index aba18e0..31e43dc 100644 --- a/t/cdbi-t/30-pager.t +++ b/t/cdbi-t/30-pager.t @@ -2,8 +2,13 @@ use strict; use Test::More; BEGIN { - eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6); + eval "use DBIx::Class::CDBICompat;"; + if ($@) { + plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + next; + } + eval "use DBD::SQLite"; + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6); } use lib 't/testlib'; diff --git a/t/cdbi-t/98-failure.t b/t/cdbi-t/98-failure.t index fe41b05..d013d22 100644 --- a/t/cdbi-t/98-failure.t +++ b/t/cdbi-t/98-failure.t @@ -1,6 +1,11 @@ use strict; use Test::More; +BEGIN { + eval "use DBIx::Class::CDBICompat;"; + plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 24); +} + #---------------------------------------------------------------------- # Test database failures #----------------------------------------------------------------------